Connect to the wrong Oracle schema
When having 2 Sonar schemas on the same Oracle instance, especially if they are in 2 different versions, Sonar can get confused and picks the first it finds. In that case, there are two known workarounds:
1. Remove the DBA rights to the Sonar users in Oracle
2. Use sonar.hibernate.default_schema in sonar.properties to set the schema. In that case, -Dsonar.hibernate.default_schema should be used as well during project analysis.
Cannot connect to MySQL database
By default, remote access to MySQL database server is disabled for security reasons. If you want to remotely access to the database server from the Sonar Maven plugin, you need to follow this quick guide.
Failed to start on 64-bit Windows 7
If you have installed a 64-bit version of the JDK or JRE, and Windows is using the 64-bit version by default, then the batch file windows-x86-32\StartSonar.bat will not start the server because the wrapper.exe program called by the batch file cannot load the lib\wrapper.dll library. You can check which version of Java is being used by opening a shell and typing "java -version". If it is a 64-bit version you will see something like "Java HotSpot (TM) 64-Bit Server VM" in the description. You can download a 32-bit version of the JDK or JRE from Oracle and install it. By default it will be installed under C:\Program Files (x86)\Java. Open up a command shell and change to the top-level directory of drive. With "dir /X" you can list the shortened names of the directories. You want the shortened name of the C:\Program Files (x86) directory, or wherever the 32-bit version of the JDK or JRE was installed. You can then add some lines like the following to the StartSonar.bat batch file to put the directory containing the 32-bit version of java.exe in the beginning of the PATH:
rem rem Force the use of a 32-bit JDK because the file lib\wrapper.dll rem will not load with the 64-bit version which the 64-bit OS uses rem be default. rem PATH C:\PROGRA~2\Java\jdk1.6.0_23\bin;%PATH% java -version
Failed to start on Windows Vista
Sonar seems unable to start when installed under the folder "Program Files" in VISTA. It should therefore not be installed there.
Failed to launch the Sonar service on Windows platform with a LocalSystem account
This error happens when the temporary file path specified for the Local System doesn't exist. Assuming that environment variables have their default settings and that Windows is installed on the ‘C’ drive, the following paths should exist:
Windows Server 2003, Windows XP : C:\Windows\system32\config\systemprofile\Local Settings\Temp
Windows Server 2008, Windows 7, Windows Vista: C:\Windows\system32\config\systemprofile\AppData\Local\Temp
In most cases, the "Temp" folder is missing and should be created. See SONAR-2660.
Failed to start Sonar with Oracle due to bad USERS table structure
When another(s) USERS table exists in the Oracle DB, if the sonar user has read access on this other USERS table, the Sonar web server can't start and an exception like the following one is thrown :
ActiveRecord::ActiveRecordError: ORA-00904: "TOTO": invalid identifier : INSERT INTO users (login, name, email, crypted_password, salt, created_at, updated_at, remember_token, remember_token_expires_at, toto, id) VALUES('admin', 'Administrator', '', 'bba4c8a0f808f9798cf8b1c153a4bb4f9178cf59', '2519754f77ea67e5d7211cd1414698f465aacebb', TIMESTAMP'2011-06-24 22:09:14', TIMESTAMP'2011-06-24 22:09:14', null, null, null, ?) ActiveRecord::ActiveRecordError: ORA-00904: "TOTO": invalid identifier : INSERT INTO users (login, name, email, crypted_password, salt, created_at, updated_at, remember_token, remember_token_expires_at, toto, id) VALUES('admin', 'Administrator', '', 'bba4c8a0f808f9798cf8b1c153a4bb4f9178cf59', '2519754f77ea67e5d7211cd1414698f465aacebb', TIMESTAMP'2011-06-24 22:09:14', TIMESTAMP'2011-06-24 22:09:14', null, null, null, ?)
To fix this issue, the rights of the sonar oracle user must be decreased to remove read access on the other(s) USERS table(s).
Failed to connect to update center via proxy
Double-check that settings for proxy in file
sonar.properties are specified correctly.
Note that if your username contains "\" (backslash), then it should be escaped - for example username "domain\user" in file should look like:
For some proxies exception "java.net.ProtocolException: Server redirected too many times" might mean incorrect username or password.
Can Sonar run in HTTPS mode
No. But you can run Sonar in a standard HTTPS infrastructure using reverse proxy (in this case the reverse proxy must be configured to set the value 'X_FORWARDED_PROTO: https' in each HTTP request header. Without this property, redirection initiated by the Sonar server will fall back on HTTP).
Solaris: Issue with JRuby 1.6.6 / 1.6.7
Due to the following JRuby issue: https://jira.codehaus.org/browse/JRUBY-6494, the following line has to be added in conf/wrapper.conf:
See SONAR-4046 for more information.
Note that this property has to be set when launching Tomcat (as the wrapper.conf file is not used when deploying in application server).
While running an analysis, you may face the following error:
12:20:22.426 INFO - Install plugins 12:20:22.426 DEBUG - Download index of plugins 12:20:22.426 DEBUG - Download: http://localhost:9000/deploy/plugins/index.txt (no proxy) 12:20:23.019 DEBUG - Download /deploy/plugins/xxx/sonar-xxx-plugin-X.Y.jar to C:\Documents and Settings\myUser\.sonar\cache\_tmp\1369156823019-681 ... ... INFO: EXECUTION FAILURE ... ... ERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar ... ... Caused by: java.lang.IllegalStateException: INVALID HASH: File C:\Documents and Settings\myUser\.sonar\cache\_tmp\1369156823019-681 was expected to have hash bc7b831dce659cbfa238c0d6f961409b but was downloaded with hash d41d8cd98f00b204e9800998ecf8427e ...
It means that the analyzer encountered an issue while downloading the plugins from the Sonar server to the machine running the project analysis.
This error could be due either to:
- A connection issue with the Sonar server. Check with your network administrator.
- A user quota issue. Indeed, by default, all the plugins are downloaded to the local space of the user running the analysis. Some companies set restrictions in terms of local user space, hence the issue. The workaround is to set the 'SONAR_USER_HOME' environment variable on the machine running the analysis to a directory with enough available space to download all the plugins.
I have locked myself out
There is currently nothing that stops you removing from every user and every group the global administrator role. the global administrator role. You then have no other solution than make an manual update in the Sonar database to get back in control.
INSERT INTO user_roles(user_id, role) VALUES ((select id from users where login='mylogin'), 'admin');
I lost the admin password
In case you lost the admin password of your Sonar instance, you can reset it by running the following update statement :
update users set crypted_password = '88c991e39bb88b94178123a849606905ebf440f5', salt='6522f3c5007ae910ad690bb1bdbf264a34884c6d' where login = 'admin'
This will reset the password to admin.
Failed to analyse a project as another analysis on the same project seems to be running at the same time (Sonar 3.4 only)
In Sonar 3.4 (SONAR-3306) a new semaphore mechanism has been introduced to prevent launching several analysis on the same project in parallel. But in some cases when an analysis of a project is unexpectedly interrupted, the lock of the semaphore is sometimes not released and in such case it's up to the Sonar administrator to relaunch the project analysis with the property 'sonar.forceAnalysis=true'. This limitation has been fixed in Sonar 3.5 (SONAR-4053).
How to remove false-positive violations?
You can use the mechanism embedded in underlying rules violation engine (//NOPMD...) or the generic mechanism implemented in Sonar : Put //NOSONAR at the end of the line of the violation. This will suppress the violation.
The //NOSONAR tag is useful to deactivate all rules at a given line but is not suitable to deactivate all rules (or only a given rule) for all the lines of a method or a class. This is why support for @SuppressWarnings("all") has been added to Sonar.
Use the Switch Off Violations plugin
Switch off violation
You can use the Review feature to flag a violation as false-positive directly from the user interface.
Documentation has been moved to http://redirect.sonarsource.com/doc/faq.html.
Documentation has been moved to http://redirect.sonarsource.com/doc/faq.html.