SonarQube 8 - Failed to instantiate SLF4J LoggerFactory

Must-share information (formatted with Markdown):

  • SonarQube 8
  • Start Sonar
  • wrapper.config configuration, sonar.properties configuration, Google, Logging, etc…

Hi All,

I am receiving an error trying to start SonarQube.

--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
	at org.sonar.application.config.FileSystemSettings.<clinit>(FileSystemSettings.java:36)
	at org.sonar.application.config.AppSettingsLoaderImpl.<init>(AppSettingsLoaderImpl.java:49)
	at org.sonar.application.App.start(App.java:50)
	at org.sonar.application.App.main(App.java:98)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
	at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 15 more

The class libraries are properly located in the wrapper.conf file:

wrapper.java.classpath.1=../../lib/jsw/*.jar
wrapper.java.classpath.2=../../lib/common/*.jar
wrapper.java.classpath.3=../../lib/*.jar
wrapper.java.library.path.1=./lib
wrapper.java.command=C:\Program Files\Java\jdk-12.0.2\bin\java

(no changes).

Hi,

Welcome to the community!

Can you downgrade to Java 11 and try again?

 
Ann

Hi Ann,

Unfortunately downgrading to Java JDK 11 didn’t resolve the issue. I am still receiving the same error message.

Mariano

Hi,

In reviewing your OP, I see that you’ve specified an absolute path to your JRE.

And I notice that you’re on Windows with a space in your path. Since the path value isn’t quoted to hold the string together across the space, I think it may be that Java isn’t being found at your specified path (C:\Program) so the default Java in %PATH% (presumably still Java 12) is being used.

 
Ann

Hi Ann,

I had completed uninstalled the JDK 12.0.2. I attempted to put quotes (single and double) to contain the path but received a different error from the wrapper attempting to launch Java. I believe the wrapper has already accounted for possible spaces in the CLASSPATH and automatically adds the surrounding quotations.

Here is what I see with a single quote (similar error utilizing a double quote):

wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM…
wrapper | Unable to execute Java command. The system cannot find the file specified. (0x2)
wrapper | “‘C:\Program Files\Java\jdk-11.0.4\bin\Java’” -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -Xmx32m -Djava.library.path="./lib" -classpath “…/…/lib/jsw/wrapper-3.2.3.jar;…/…/lib/common/elasticsearch-6.8.0.jar;…/…/lib/common/guava-18.0.jar;…/…/lib/common/hazelcast-3.12.1.jar;…/…/lib/common/java-saml-2.5.0.jar;…/…/lib/common/java-saml-core-2.5.0.jar;…/…/lib/common/jul-to-slf4j-1.7.25.jar;…/…/lib/common/log4j-to-slf4j-2.8.2.jar;…/…/lib/common/logback-classic-1.2.3.jar;…/…/lib/common/parent-join-client-6.8.0.jar;…/…/lib/common/percolator-client-6.8.0.jar;…/…/lib/common/protobuf-java-3.7.0.jar;…/…/lib/common/slf4j-api-1.7.25.jar;…/…/lib/common/sonar-auth-saml-8.0.jar;…/…/lib/common/sonar-ce-8.0.jar;…/…/lib/common/sonar-ce-common-8.0.jar;…/…/lib/common/sonar-ce-task-8.0.jar;…/…/lib/common/sonar-ce-task-projectanalysis-8.0.jar;…/…/lib/common/sonar-channel-4.1.jar;…/…/lib/common/sonar-core-8.0.jar;…/…/lib/common/sonar-db-core-8.0.jar;…/…/lib/common/sonar-db-dao-8.0.jar;…/…/lib/common/sonar-db-migration-8.0.jar;…/…/lib/common/sonar-duplications-8.0.jar;…/…/lib/common/sonar-main-8.0.jar;…/…/lib/common/sonar-markdown-8.0.jar;…/…/lib/common/sonar-plugin-api-8.0-all.jar;…/…/lib/common/sonar-plugin-api-impl-8.0.jar;…/…/lib/common/sonar-process-8.0.jar;…/…/lib/common/sonar-scanner-protocol-8.0.jar;…/…/lib/common/sonar-server-common-8.0.jar;…/…/lib/common/sonar-update-center-common-1.18.0.487.jar;…/…/lib/common/sonar-webserver-8.0.jar;…/…/lib/common/sonar-webserver-api-8.0.jar;…/…/lib/common/sonar-webserver-auth-8.0.jar;…/…/lib/common/sonar-webserver-core-8.0.jar;…/…/lib/common/sonar-webserver-es-8.0.jar;…/…/lib/common/sonar-webserver-webapi-8.0.jar;…/…/lib/common/sonar-webserver-ws-8.0.jar;…/…/lib/common/sonar-ws-8.0.jar;…/…/lib/common/transport-6.8.0.jar;…/…/lib/common/transport-netty4-client-6.8.0.jar;…/…/lib/common/xmlsec-2.1.4.jar;…/…/lib/sonar-application-8.0.jar;…/…/lib/sonar-shutdowner-8.0.jar” -Dwrapper.key=“PFSE2bR15gF0SgLe” -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=27812 -Dwrapper.version=“3.2.3” -Dwrapper.native_library=“wrapper” -Dwrapper.cpu.timeout=“10” -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.sonar.application.App

I’ve also added the path of the JDK 11 to our environment path without any luck launching SonarQube. Same error.

Hi @Mariano.Gagliardi,

Just to clarify: you downloaded SonarQube 8.0, didn’t change any config whatsoever (except the wrapper.java.command param), and tried running the StartSonar.bat batch file? Have you ran other versions of SonarQube before on this machine?

Hi @Wouter_Admiraal

Here is what has been done thus far.

  1. Downgraded the Java JDK from 12.0.2 to 11.0.4.

  2. Added the JDK path location to the Windows Environment Variables.

  3. Verified via a command prompt the correct version is executed by typing Java -version

    H:>java -version
    java version “11.0.4” 2019-07-16 LTS
    Java™ SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
    Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

  4. Modified the sonar.properties file:

    • uncommented sonar.jdbc.username= (and set the appropriate details)
    • uncommented sonar.jdbc.password= (and set the appropriate details)
    • added sonar.web.javaOpts=-server
    • uncommented sonar.jdbc.url=jdbc:sqlserver: (and set the appropriate details)
    • uncommented sonar.log.level=TRACE (just this morning)
  5. Modified the wrapper.config file:

    • commented back the wrapper.java.command=C:\Program Files\Java\jdk-11.0.4\bin\Java as the JDK path is now set at the machine level.

I am hoping to get more details now that I have changed the logging level to TRACE instead of INFO. If you have any ideas please let me know.

Thank you,

Mariano

Hi All,

With TRACE logging set, I now have some more information but no resolution as of yet.

New details from sonar.log file:

WrapperManager class initialized by thread: main Using classloader: jdk.internal.loader.ClassLoaders$AppClassLoader@2cdf8d8a
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

Wrapper Manager: JVM #1
Running a 64-bit JVM.
Wrapper Manager: Registering shutdown hook
Wrapper Manager: Using wrapper
Load native library. One or more attempts may fail if platform specific libraries do not exist.
Loading native library failed: wrapper-windows-x86-64.dll Cause: java.lang.UnsatisfiedLinkError: no wrapper-windows-x86-64 in java.library.path: [./lib]
Loaded native library: wrapper.dll
Calling native initialization method.
Initializing WrapperManager native library.
Java Executable: C:\Program Files\Java\jdk-11.0.4\bin\Java.exe
Windows version: 10.0.14393
Java Version : 11.0.4+10-LTS Java HotSpot™ 64-Bit Server VM
Java VM Vendor : Oracle Corporation

We also have Java Version 8 Update 221 (build 1.8.0_221-b11) JRE installed on the server.

Hi,
It’s hard to tell what’s wrong based on those error messages but here are some things you could check.

  • Double check if you have a 64 bit Windows machine. Otherwise use the 32 bit versions of the JVM and wrapper
  • Check if Java executable has the permissions to read and execute files in the SonarQube install directory.
  • Try with a fresh install of SonarQube (maybe something got changed while you were fixing the version of Java)