Openjdk8-jre java.lang.ExceptionInInitializerError

Environment

  • SonarQube Scanner 3.3.0.1492
  • openjdk version “1.8.0_201”
    OpenJDK Runtime Environment (IcedTea 3.11.0) (Alpine 8.201.08-r0)
    OpenJDK 64-Bit Server VM (build 25.201-b08, mixed mode)

I have a stable docker image in AWS ECR created weeks ago from the exact same code and works fine. After rebuilding the image, I’m getting java.lang.ExceptionInInitializerError. I am aware this may be not related to scanner itself, but maybe someone faced a similar issue and resolved.

I’m happy to share .sonarqube/** if it helps.

Docker image:

FROM  mcr.microsoft.com/dotnet/core/sdk:2.2-alpine

RUN dotnet tool install dotnet-sonarscanner --tool-path /bin
RUN apk add --no-cache openjdk8-jre \
    && apk add --no-cache bash

COPY /cicd/ /cicd/

RUN chmod +x /cicd/run

ENTRYPOINT [ "/cicd/run" ]

Scan result

23:57:54.491 INFO: Project root configuration file: /app/.sonarqube/out/sonar-project.properties
23:57:54.612 INFO: SonarQube Scanner 3.3.0.1492
23:57:54.612 INFO: Java 1.8.0_201 Oracle Corporation (64-bit)
23:57:54.612 INFO: Linux 4.9.125-linuxkit amd64
23:57:54.612 INFO: SONAR_SCANNER_OPTS=-Xmx2048m
23:57:54.625 INFO: Bitbucket Cloud Pipelines detected
23:57:54.960 DEBUG: keyStore is :
23:57:54.960 DEBUG: keyStore type is : jks
23:57:54.960 DEBUG: keyStore provider is :
23:57:54.960 DEBUG: init keystore
23:57:54.962 DEBUG: init keymanager of type SunX509
23:57:55.128 INFO: ------------------------------------------------------------------------
23:57:55.129 INFO: EXECUTION FAILURE
23:57:55.129 INFO: ------------------------------------------------------------------------
23:57:55.129 INFO: Total time: 0.700s
23:57:55.159 ERROR: Error during SonarQube Scanner execution
23:57:55.158 INFO: Final Memory: 3M/31M
23:57:55.159 INFO: ------------------------------------------------------------------------
java.lang.ExceptionInInitializerError
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.tls.CertificateChainCleaner.get(CertificateChainCleaner.java:41)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:694)
	at org.sonarsource.scanner.api.internal.OkHttpClientFactory.create(OkHttpClientFactory.java:74)
	at org.sonarsource.scanner.api.internal.ServerConnection.<init>(ServerConnection.java:51)
	at org.sonarsource.scanner.api.internal.ServerConnection.create(ServerConnection.java:61)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:181)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:122)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.security.ProviderException: Could not initialize NSS
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:223)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:224)
	at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
	at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
	at sun.security.jca.ProviderList.loadAll(ProviderList.java:282)
	at sun.security.jca.ProviderList.removeInvalid(ProviderList.java:299)
	at sun.security.jca.Providers.getFullProviderList(Providers.java:173)
	at java.security.Security.getProviders(Security.java:487)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.isConscryptPreferred(Platform.java:195)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.findPlatform(Platform.java:207)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.<clinit>(Platform.java:78)
	... 10 more
Caused by: java.io.FileNotFoundException: /usr/lib/libnss3.so
	at sun.security.pkcs11.Secmod.initialize(Secmod.java:193)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:218)
	... 27 more
Process returned exit code 1
The SonarQube Scanner did not complete successfully

The diff between operational and broken image:

Item stable broken
dotnet --version 2.2.104 2.2.105
dotnet --list-sdks 2.2.104 [/usr/share/dotnet/sdk] 2.2.105 [/usr/share/dotnet/sdk]
dotnet --list-runtimes Microsoft.AspNetCore.All 2.2.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
java -version openjdk version "1.8.0_191"
OpenJDK Runtime Environment (IcedTea 3.10.0) (Alpine 8.191.12-r0)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (IcedTea 3.11.0) (Alpine 8.201.08-r0)
OpenJDK 64-Bit Server VM (build 25.201-b08, mixed mode)
SonarQube Scanner 3.3.0.1492 3.3.0.1492

I managed to update java and the error message has changes to the following:

Writing processing summary to /app/.sonarqube/out/ProjectInfo.log
Using the supplied value for SONAR_SCANNER_OPTS. Value: -Xmx2048m
Calling the SonarQube Scanner...
Overwriting the value of environment variable 'SONAR_SCANNER_OPTS'. Old value: -Xmx2048m, new value: -Xmx2048m
Executing file /bin/.store/dotnet-sonarscanner/4.6.0/dotnet-sonarscanner/4.6.0/tools/netcoreapp2.1/any/sonar-scanner-3.3.0.1492/bin/sonar-scanner
  Args: -Dsonar.scanAllFiles=true -Dproject.settings=/app/.sonarqube/out/sonar-project.properties --embedded --debug <sensitive data removed>
  Working directory: /app
  Timeout (ms):-1
  Process id: 837
03:00:41.290 INFO: Scanner configuration file: /bin/.store/dotnet-sonarscanner/4.6.0/dotnet-sonarscanner/4.6.0/tools/netcoreapp2.1/any/sonar-scanner-3.3.0.1492/conf/sonar-scanner.properties
03:00:41.292 INFO: Project root configuration file: /app/.sonarqube/out/sonar-project.properties
03:00:41.337 INFO: SonarQube Scanner 3.3.0.1492
03:00:41.337 INFO: Java 13-ea Oracle Corporation (64-bit)
03:00:41.337 INFO: Linux 4.19.23-coreos-r1 amd64
03:00:41.337 INFO: SONAR_SCANNER_OPTS=-Xmx2048m
03:00:41.342 INFO: Bitbucket Cloud Pipelines detected
03:00:41.469 DEBUG: keyStore is : 
03:00:41.470 DEBUG: keyStore type is : pkcs12
03:00:41.475 DEBUG: keyStore provider is : 
03:00:41.476 DEBUG: init keystore
03:00:41.477 DEBUG: init keymanager of type SunX509
03:00:41.587 DEBUG: Create: /root/.sonar/cache
03:00:41.588 INFO: User cache: /root/.sonar/cache
03:00:41.589 DEBUG: Create: /root/.sonar/cache/_tmp
03:00:41.591 DEBUG: Extract sonar-scanner-api-batch in temp...
03:00:41.595 DEBUG: Get bootstrap index...
03:00:41.595 DEBUG: Download: https://sonarcloud.io/batch/index
03:00:42.310 DEBUG: Get bootstrap completed
03:00:42.313 DEBUG: Download https://sonarcloud.io/batch/file?name=sonar-scanner-engine-shaded-developer-7.7.0.22792-all.jar to /root/.sonar/cache/_tmp/fileCache12234113118615055125.tmp
03:00:45.751 DEBUG: Create isolated classloader...
03:00:45.761 DEBUG: Start temp cleaning...
03:00:45.764 DEBUG: Temp cleaning done
03:00:45.765 DEBUG: Execution getVersion
03:00:45.772 INFO: SonarQube server 7.7.0
03:00:45.773 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
03:00:45.773 DEBUG: Work directory: /app/.sonarqube/out/.sonar
03:00:45.775 DEBUG: Execution execute
03:00:46.076 INFO: Load global settings
03:00:46.623 DEBUG: GET 200 https://sonarcloud.io/api/settings/values.protobuf | time=540ms
WARNING: WARNING: An illegal reflective access operation has occurred
WARNING: WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/root/.sonar/cache/23571578e208a8279aa89106f933d770/sonar-scanner-engine-shaded-developer-7.7.0.22792-all.jar) to field java.nio.Buffer.address
WARNING: WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: WARNING: All illegal access operations will be denied in a future release
03:00:46.651 INFO: Load global settings (done) | time=577ms
03:00:46.654 INFO: Server id: BD367519-AWHW8ct9-T_TB3XqouNu
03:00:46.666 DEBUG: Create : /root/.sonar/_tmp
03:00:46.667 INFO: User cache: /root/.sonar/cache
03:00:46.670 INFO: Load/download plugins
03:00:46.671 INFO: Load plugins index
03:00:46.765 DEBUG: GET 200 https://sonarcloud.io/api/plugins/installed | time=94ms
03:00:46.776 INFO: Load/download plugins (done) | time=106ms
03:00:46.780 INFO: ------------------------------------------------------------------------
03:00:46.780 INFO: EXECUTION FAILURE
03:00:46.780 INFO: ------------------------------------------------------------------------
03:00:46.780 INFO: Total time: 5.497s
03:00:46.801 INFO: Final Memory: 5M/37M
03:00:46.801 INFO: ------------------------------------------------------------------------
03:00:46.801 ERROR: Error during SonarQube Scanner execution
java.lang.NumberFormatException: For input string: "13-ea"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
	at java.base/java.lang.Integer.parseInt(Integer.java:658)
	at java.base/java.lang.Integer.parseInt(Integer.java:776)
	at com.google.gson.util.VersionUtils.determineMajorJavaVersion(VersionUtils.java:28)
	at com.google.gson.util.VersionUtils.<clinit>(VersionUtils.java:24)
	at com.google.gson.internal.reflect.ReflectionAccessor.<clinit>(ReflectionAccessor.java:36)
	at com.google.gson.internal.ConstructorConstructor.<init>(ConstructorConstructor.java:51)
	at com.google.gson.Gson.<init>(Gson.java:205)
	at com.google.gson.Gson.<init>(Gson.java:185)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.listInstalledPlugins(ScannerPluginInstaller.java:104)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:76)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:60)
	at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:59)
	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.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	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.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Process returned exit code 1
The SonarQube Scanner did not complete successfully
03:00:46.826  Post-processing failed. Exit code: 1
make: *** [Makefile:34: analyse] Error 1
1 Like

Did you able to fix it I am running into same error

Add apk add --no-cache nss to the Dockerfile. :wink:

(About your last error, you installed Java 13 Early-Access. This isn’t supported.)