Template for a good bug report, formatted with Markdown:
- Versions used (SonarQube, Scanner, Plugin, and any relevant extension)
Latest version of SonarQube: Version 8.5 (build 37579) - Error observed (wrap logs/code around triple quote ``` for proper formatting)
2020.11.13 18:25:14 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://dtw01etsdb01c\dt01ets02;databaseName=Sonar;integratedSecurity=true
2020.11.13 18:25:29 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:166)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
at org.sonar.server.platform.PlatformImpl.startLevel1Container(PlatformImpl.java:172)
at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:118)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
... 24 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (This driver is not configured for integrated authentication. ClientConnectionId:b25351cc-a0a4-47f4-bad4-d162a8bb5f0c)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:669)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:544)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:115)
... 25 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:b25351cc-a0a4-47f4-bad4-d162a8bb5f0c
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2924)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:73)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3686)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3675)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2488)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2142)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1993)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1164)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:760)
at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:55)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:115)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:665)
... 30 common frames omitted
Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path: [C:\Program Files\Java\openjdk-11.0.8_10\bin, C:\Windows\Sun\Java\bin, C:\Windows\system32, C:\Windows, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files\Puppet Labs\Puppet\bin, c:\Program Files\Venafi\Agent\Libs, C:\Program Files\Java\openjdk-11.0.8_10\bin, C:\Users\a952856-a\AppData\Local\Microsoft\WindowsApps, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:52)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3685)
... 42 common frames omitted
-
Steps to reproduce
Install the latest version of the Microsoft SQL Server JDBC Driver v8.4 from: https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 -
Potential workaround
Install a version of the SQL Server JDBC driver prior to v8.2 -
Scanner command used when applicable (private details masked)
N/A -
In case of SonarCloud:
N/A- ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
N/A - CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI, Jenkins, other)
N/A
- ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
Description:
I was installing a new instance of SonarQube on Windows Server 2019 and using a separate server that contains SQL Server 2016 as the holding database. This is sitting on a Windows 2012 R2 server OS.
The steps to reproduce this is:
- Setup your SQL Server database as stipulated in the SonarQube documentation
- Setup Java on your App server as per the SonarQube install documentation
- Setup SonarQube as per the SonarQube install documentation
- Setup the SQL Server JDBC Driver as per the SonarQube install documentation
- Configure SonarQube via the properties file, as per the SonarQube install documentation
- Run StartSonar.bat
- You will get a failure to start the Web Service and in the logs the above error will be displayed.
After much pulling my hair out, it turns out the the SQL Server JDBC Driver has been renamed from sqljdbc_auth.dll to mssql-jdbc_auth-8.4.1.x64.dll as of v8.2. Once I replaced the v8.4 driver that I had installed with v7.4 this version of the driver was found and the web server was able to start up. Not sure if I should not be using v8.4 or v8.2 of the driver, but based on the matrix given by Microsoft, found here: https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server-support-matrix?view=sql-server-ver15#java-and-jdbc-specification-support
It did not seem to indicate I should not be using it. Therefore I assume the latest version was backward compatible and okay to use. So not sure if it is the “Wrapper” that is needing to use sqjjdbc_auth or SonarQube. But either way it is failing due to the name change. By going back to v7.4 of the driver I was able to solve the problem.