Start SonarQube 8.0 as service: problem with MS SQL integrated authentication

  • Developer Edition-Version 8.0 (build 29455)
  • Start SonarQube as Service
  • MS SQL Server 2017, Microsoft JDBC Driver 7.2 for SQL Server

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Zulu\zulu-11\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Microsoft JDBC Driver 7.2 for SQL Server\sqljdbc_7.2\enu\auth\x64;C:\Users\svc-sonarservice\AppData\Local\Microsoft\WindowsApps;

When starting from command line with StartSonar.bat SonarQube is starting up successfully.

  • InstallNTService, StartNTService, adjust account of serice log on to the same user the command line was opened.
    Starting service fails, The java.library.path is different from above environment PATH:
    from web.log:
 2019.11.21 14:12:57 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:87)
 	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:135)
 	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
 	at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:164)
 	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:4770)
 	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
 	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
 	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
 	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:119)
 	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:84)
 	... 24 common frames omitted
 Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (This driver is not configured for integrated authentication. ClientConnectionId:0e615e04-4484-417f-a016-d6a693a6e9bd)
 	at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385)
 	at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)
 	at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
 	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:116)
 	... 25 common frames omitted
 Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:0e615e04-4484-417f-a016-d6a693a6e9bd
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2892)
 	at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:72)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3636)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3627)
 	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2456)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2103)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1950)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1162)
 	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:735)
 	at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:53)
 	at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:291)
 	at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2395)
 	at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)
 	... 30 common frames omitted
 Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path: [C:\Program Files\Zulu\zulu-11\bin, C:\Windows\Sun\Java\bin, C:\Windows\system32, C:\Windows, C:\Users\svc-sonarservice\AppData\Local\Microsoft\WindowsApps, ., .]
 	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
 	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
 	at java.base/java.lang.System.loadLibrary(System.java:1867)
 	at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:52)
 	at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3635)
 	... 42 common frames omitted

Why does Sonarqube not find the sqljdbc_auth when startet as service?

Workaround: copy sqljdbc_auth.dll to C:\Program Files\Zulu\zulu-11\bin

Hi,

the sonarqube doc https://docs.sonarqube.org/latest/setup/install-server/ has:

Integrated Security

To use integrated security:

  1. Download the Microsoft SQL JDBC Driver 7.2.2 package and copy the 64-bit version of sqljdbc_auth.dll to any folder in your path.

Did you try that ?
Copying to java bin folder - as you did - is the other way.

Gilbert

Hi @Rebse,

yes I had the 64bit version of the dll to the bold part of the PATH in my original post.
This file I copied later on to the Zulu bon directory as a workaround.

Still the same issue when starting as service of SonarQube 8.9 and now mssql-jdbc_auth-9.2.0.x64.dll