Sonar Qube Developer Image not starting Docker compose up failed

We have bought SoanarQube Developer License:

We have deployed it in Azure using Docuker Hub.
Container type Docker Compose. It was working fine but since last 2 weeks it is not working anymore.
I ran the docker compose yml in my local machine and found it is failing to start the docker developer image.

please find the yml file that is being used in the Azure (password masked with X)

version: '3.3'
services:
  sonarqube:
    depends_on:
      - db
    image: sonarqube:developer
    command: "-Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmap=false"
    ports:
      - "9000:9000"
    volumes:
      - sonarqube-conf:/opt/sonarqube/conf
      - sonarqube-data:/opt/sonarqube/data
      - sonarqube-extensions:/opt/sonarqube/extensions
      - sonarqube-bundled-plugins:/opt/sonarqube/lib/bundled-plugins
    environment:
      - SONARQUBE_JDBC_URL=jdbc:sqlserver://db:1433;databaseName=sonar
      - SONARQUBE_JDBC_USERNAME=sa
      - SONARQUBE_JDBC_PASSWORD= XXXXXXXXXXXXXXXXXXXXXX
      - SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true

  db:
    image: mcr.microsoft.com/mssql/server:2019-latest
    container_name: mssql-server
    volumes:
      - mssql:/var/opt/mssql
    environment:
      ACCEPT_EULA: 'Y'
      MSSQL_SA_PASSWORD: XXXXXXXXXXXXXXXXXXXXXX
      MSSQL_PID: Express
      MSSQL_COLLATION: SQL_Latin1_General_CP1_CS_AS

volumes:
  sonarqube-conf:
    external: true
  sonarqube-data:
    external: true
  sonarqube-extensions:
    external: true
  sonarqube-bundled-plugins:
    external: true
  mssql:
    external: true

you can see in the above screenshot that the container consists of 2 images one is mssql and nother is sonarqube. MSSQL is running fine but the sonarqube is not .

can you please guide us what can actually happen? and how to fix the issue.

Hi,

What do your server logs say?

 
Ann

Hi @ganncamp ,

here is the log below. it seems like it is not able to connect to the DB.
but we have not done any changes in the meantime. Can you please check the log below and suggest what and where should I change the configuration.

2022-09-13T09:32:05.910071603Z: [INFO]  Caused by: java.lang.IllegalStateException: Fail to connect to database
2022-09-13T09:32:05.910075403Z: [INFO]  	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
2022-09-13T09:32:05.910079103Z: [INFO]  	at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
2022-09-13T09:32:05.910082903Z: [INFO]  	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
2022-09-13T09:32:05.910086804Z: [INFO]  	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
2022-09-13T09:32:05.910090604Z: [INFO]  	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
2022-09-13T09:32:05.910094304Z: [INFO]  	... 44 common frames omitted
2022-09-13T09:32:05.910098004Z: [INFO]  Caused by: java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
2022-09-13T09:32:05.910101804Z: [INFO]  	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:118)
2022-09-13T09:32:05.910105404Z: [INFO]  	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
2022-09-13T09:32:05.910109004Z: [INFO]  	... 48 common frames omitted
2022-09-13T09:32:05.910112704Z: [INFO]  Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:53bb24fd-c408-457e-a6b6-b8764295c8f1)
2022-09-13T09:32:05.910117304Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:653)
2022-09-13T09:32:05.910121004Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:531)
2022-09-13T09:32:05.910125004Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.lambda$getConnection$0(BasicDataSource.java:720)
2022-09-13T09:32:05.910128704Z: [INFO]  	at java.base/java.security.AccessController.doPrivileged(Native Method)
2022-09-13T09:32:05.910141105Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:722)
2022-09-13T09:32:05.910162005Z: [INFO]  	at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
2022-09-13T09:32:05.910166405Z: [INFO]  	at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)
2022-09-13T09:32:05.910296508Z: [INFO]  	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:115)
2022-09-13T09:32:05.910308208Z: [INFO]  	... 49 common frames omitted
2022-09-13T09:32:05.910580514Z: [INFO]  Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:53bb24fd-c408-457e-a6b6-b8764295c8f1
2022-09-13T09:32:05.917623557Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680)
2022-09-13T09:32:05.917636957Z: [INFO]  	at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2113)
2022-09-13T09:32:05.917646758Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3204)
2022-09-13T09:32:05.917650758Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2833)
2022-09-13T09:32:05.917654858Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2671)
2022-09-13T09:32:05.917658658Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1640)
2022-09-13T09:32:05.917662358Z: [INFO]  	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:936)
2022-09-13T09:32:05.917666058Z: [INFO]  	at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:52)
2022-09-13T09:32:05.917669858Z: [INFO]  	at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:374)
2022-09-13T09:32:05.917673658Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:106)
2022-09-13T09:32:05.917677458Z: [INFO]  	at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:649)
2022-09-13T09:32:05.917681158Z: [INFO]  	... 56 common frames omitted
2022-09-13T09:32:05.917685058Z: [INFO]  Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-09-13T09:32:05.917688959Z: [INFO]  	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
2022-09-13T09:32:05.917692659Z: [INFO]  	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:353)
2022-09-13T09:32:05.917696359Z: [INFO]  	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:296)
2022-09-13T09:32:05.917699959Z: [INFO]  	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:291)
2022-09-13T09:32:05.917712259Z: [INFO]  	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)
2022-09-13T09:32:05.917716359Z: [INFO]  	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
2022-09-13T09:32:05.917720159Z: [INFO]  	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
2022-09-13T09:32:05.917723959Z: [INFO]  	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
2022-09-13T09:32:05.939118495Z: [INFO]  	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443)
2022-09-13T09:32:05.939389601Z: [INFO]  	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
2022-09-13T09:32:05.940920932Z: [INFO]  	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:183)
2022-09-13T09:32:05.940937432Z: [INFO]  	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
2022-09-13T09:32:05.940942233Z: [INFO]  	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
2022-09-13T09:32:05.940946633Z: [INFO]  	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1416)
2022-09-13T09:32:05.940950733Z: [INFO]  	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
2022-09-13T09:32:05.940954633Z: [INFO]  	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
2022-09-13T09:32:05.940959333Z: [INFO]  	at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2021)
2022-09-13T09:32:05.940963233Z: [INFO]  	... 65 common frames omitted
2022-09-13T09:32:05.940967033Z: [INFO]  Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-09-13T09:32:05.940971033Z: [INFO]  	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
2022-09-13T09:32:05.940974933Z: [INFO]  	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
2022-09-13T09:32:05.940978633Z: [INFO]  	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
2022-09-13T09:32:05.940982333Z: [INFO]  	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
2022-09-13T09:32:05.940986033Z: [INFO]  	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:233)
2022-09-13T09:32:05.940989734Z: [INFO]  	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:110)
2022-09-13T09:32:05.940993534Z: [INFO]  	at com.microsoft.sqlserver.jdbc.TDSChannel$HostNameOverrideX509TrustManager.checkServerTrusted(IOBuffer.java:1702)
2022-09-13T09:32:05.940997334Z: [INFO]  	at java.base/sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:1510)
2022-09-13T09:32:05.941001034Z: [INFO]  	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:638)
2022-09-13T09:32:05.941004934Z: [INFO]  	... 77 common frames omitted
2022-09-13T09:32:05.941020734Z: [INFO]  Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-09-13T09:32:05.941024834Z: [INFO]  	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
2022-09-13T09:32:05.948466486Z: [INFO]  	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
2022-09-13T09:32:05.948670290Z: [INFO]  	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
2022-09-13T09:32:05.948676890Z: [INFO]  	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
2022-09-13T09:32:05.948681090Z: [INFO]  	... 85 common frames omitted
2022-09-13T09:32:06.327974722Z: [INFO]  2022.09.13 09:32:06 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2022-09-13T09:32:06.367921237Z: [INFO]  2022.09.13 09:32:06 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2022-09-13T09:32:06.608504741Z: [INFO]  2022.09.13 09:32:06 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2022-09-13T09:32:06.932488545Z: [INFO]  2022.09.13 09:32:06 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2022-09-13T09:32:06.932520546Z: [INFO]  2022.09.13 09:32:06 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022-09-13T09:32:06.933594168Z: [INFO]  2022.09.13 09:32:06 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

Hi,

I guess in the last two weeks you upgraded to SonarQube 9.6? You might want to check the Release Upgrade Notes.

 
HTH,
Ann

Hi Ann,

We didn’t change anything.
But after your last comment I did the changes.
Changed the SonarQube image

image: sonarqube:9.6-developer

and then changed the JDBC String:

SONARQUBE_JDBC_URL=jdbc:sqlserver://db:1433;databaseName=sonar;encrypt=false;trustServerCertificate=true

And now we have below errors:

2022-09-13T16:49:21.376426408Z
2022-09-13 16:49:21.37 Logon       Error: 18401, Severity: 14, State: 1.
2022-09-13T16:49:21.379097463Z
2022-09-13 16:49:21.37 Logon       Login failed for user 'sa'. Reason: Server is in script upgrade mode. Only administrator can connect at this time. [CLIENT: 172.16.32.2]

Hi,

What does that error mean to you?

(And BTW, it’s coming straight from the DB, not from SonarQube itself.)

 
Ann

I have no clue.
That is why I am looking for a solution who can tell how to fix it.

The whole configuration is there above as we used it in the docker compose file.
we have also mapped the external volumes in Azure Storage as fileshare.
I have used the guide :

https://lemtirisalah.com/deploying-sonarqube-and-sql-server-in-azure-app-service-for-containers-with-docker-compose/

initially to configure and it was working fine.

would be nice if any can fix this issue or guide me how to fix it.

Hi,

As I said, this error is coming straight from your DB, not from SonarQube. If I search on the error string, I land on SO.

 
HTH,
Ann

if i understand correctly, we should wait when we get this Login Failed due to Server Grade ?
But is it normal that the database is upgrading more than over 12 hours ?

Hi,

This is something you should talk to your DBA about. It really is outside the scope of SonarQube.

 
:woman_shrugging:
Ann