java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" (GitLab CI/CD)

My description of the issue

During an otherwise ordinary scan in a self-hosted GitLab CI/CD pipeline (GitLab Enterprise Edition v16.0.2-ee), the scanner throws the exception shown in title:

java.io.IOException: Resource not found: “org/joda/time/tz/data/ZoneInfoMap” ClassLoader: ClassRealm{ruby}

The scan continues and provides meaningful results. I’ll include redacted logs below.

My next step–I’ll let you know how it works out–is to try the suggestion provided near the end of the logs:

2023-09-19T19:18:00.186Z [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass ‘–add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED’ to enable.

Must-share information

Versions

  • Analyzing on SonarQube server 9.9.1.69595
  • SonarScanner 5.0.1.3006
  • Loaded core extensions: developer-scanner

Deployed

  • Using Docker executor with image sonarsource/sonar-scanner-cli:latest …
  • Using locally found image version due to “if-not-present” pull policy
  • Using docker image sha256:339f7a6c75e4cd6054528efe3ecffcf68ff777acf431ab599d2078c8925d74b7
    • for sonarsource/sonar-scanner-cli:latest
    • with digest sonarsource/sonar-scanner-cli@sha256:b3ac50989c14b1574859bd49cbfb8cb93affad89b053610cc0523e3ed7f95f80 …
  • Running in GitLab CI/CD pipeline
    • GitLab Runner: v16.0.1
    • GitLab Server: GitLab Enterprise Edition v16.0.2-ee

Trying to achieve

a scan of my project. It is indeed scanning, but along the way throws an exception, then continues on with no obvious sign of any ill effects.

I have tried…

So far, I’ve just tried triggering the scan like we always do. I have done nothing to try to resolve the issue.

Possibly related to

Logs (somewhat redacted, in text form, as well-formatted as I can manage)

Running with gitlab-runner 16.0.1 (79704081)
  on docker-runner ~REDACTED~, system ID: ~REDACTED~
section_start:1695151049:resolve_secrets
eeeResolving secrets
section_end:1695151049:resolve_secrets
esection_start:1695151049:prepare_executor
eeePreparing the "docker" executor
eUsing Docker executor with image sonarsource/sonar-scanner-cli:latest ...
eUsing locally found image version due to "if-not-present" pull policy
eUsing docker image sha256:339f7a6c75e4cd6054528efe3ecffcf68ff777acf431ab599d2078c8925d74b7 for sonarsource/sonar-scanner-cli:latest with digest sonarsource/sonar-scanner-cli@sha256:b3ac50989c14b1574859bd49cbfb8cb93affad89b053610cc0523e3ed7f95f80 ...
section_end:1695151051:prepare_executor
esection_start:1695151051:prepare_script
eeePreparing environment
Running on runner-fvmng-f--project-63-concurrent-0 via shared-runner...
section_end:1695151052:prepare_script
esection_start:1695151052:get_sources
eeeGetting source from Git repository
eFetching changes...
Initialized empty Git repository in /builds/~REDACTED~/.git/
eCreated fresh repository.
eChecking out ~REDACTED~ as detached HEAD (ref is refs/merge-requests/~REDACTED~/head)...

eSkipping Git submodules setup
section_end:1695151054:get_sources
esection_start:1695151054:step_script
eeeExecuting "step_script" stage of the job script
eUsing docker image sha256:339f7a6c75e4cd6054528efe3ecffcf68ff777acf431ab599d2078c8925d74b7 for sonarsource/sonar-scanner-cli:latest with digest sonarsource/sonar-scanner-cli@sha256:b3ac50989c14b1574859bd49cbfb8cb93affad89b053610cc0523e3ed7f95f80 ...
e$ ls -lart
total 44
drwxrwxrwx    4 root     root          4096 Sep 19 19:17 ..
-rw-rw-rw-    1 root     root           174 Sep 19 19:17 sonar-project.properties
drwxrwxrwx    2 root     root          4096 Sep 19 19:17 pipeline
drwxrwxrwx    4 root     root          4096 Sep 19 19:17 inspec
drwxrwxrwx    3 root     root          4096 Sep 19 19:17 ansible-playbooks
-rw-rw-rw-    1 root     root          5296 Sep 19 19:17 README.md
-rw-rw-rw-    1 root     root          1882 Sep 19 19:17 .gitlab-ci.yml
-rw-rw-rw-    1 root     root          2582 Sep 19 19:17 .gitignore
drwxrwxrwx    6 root     root          4096 Sep 19 19:17 .git
drwxrwxrwx    6 root     root          4096 Sep 19 19:17 .
e$ echo 'MergeRequestID='~REDACTED~
MergeRequestID=~REDACTED~
e$ echo 'FeatureBranch='~REDACTED~
FeatureBranch=~REDACTED~
e$ echo 'TargetBranch='~REDACTED~
TargetBranch=master
e$ sonar-scanner -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.pullrequest.key=$CI_MERGE_REQUEST_IID -Dsonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -Dsonar.pullrequest.base=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/~REDACTED~/sonar-project.properties
INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.8 Alpine (64-bit)
INFO: Linux 5.19.0-1029-aws amd64
INFO: User cache: /builds/ihlc/~REDACTED~/.sonar/cache
INFO: Analyzing on SonarQube server 9.9.1.69595
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=163ms
INFO: Server id: ~REDACTED~
INFO: User cache: /builds/~REDACTED~/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=66ms
INFO: Load/download plugins (done) | time=3657ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Process project properties (done) | time=46ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=4ms
INFO: Project key: ~REDACTED~
INFO: Base dir: /builds/~REDACTED~
INFO: Working dir: /builds/~REDACTED~/.scannerwork
INFO: Load project settings for component key: '~REDACTED~'
INFO: Load project settings for component key: '~REDACTED~' (done) | time=24ms
INFO: Load project branches
INFO: Load project branches (done) | time=28ms
INFO: Load branch configuration
INFO: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
INFO: Load branch configuration (done) | time=7ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=83ms
INFO: Load active rules
INFO: Load active rules (done) | time=1948ms
INFO: Load analysis cache
INFO: Load analysis cache (7.1 kB) | time=44ms
INFO: Pull request ~REDACTED~ for merge into master from ~REDACTED~
INFO: Load project repositories
INFO: Load project repositories (done) | time=40ms
INFO: SCM collecting changed files in the branch
INFO: Merge base sha1: ~REDACTED~
INFO: SCM collecting changed files in the branch (done) | time=371ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 368 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for py: Sonar way
INFO: Quality profile for ruby: Sonar way
INFO: Quality profile for shell: ShellCheck
INFO: Quality profile for xml: Sonar way
INFO: Quality profile for yaml: ~REDACTED~
INFO: ------------- Run sensors on module ~REDACTED~
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=37ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=226ms
INFO: Sensor IaC Kubernetes Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=96ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=2ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=25ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML is restricted to changed files only
INFO: Sensor HTML [web] (done) | time=7ms
INFO: Sensor XML Sensor [xml]
INFO: Sensor XML Sensor is restricted to changed files only
INFO: Sensor XML Sensor [xml] (done) | time=2ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: Sensor TextAndSecretsSensor is restricted to changed files only
INFO: Sensor TextAndSecretsSensor [text] (done) | time=28ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=28ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor YAML Sensor [yaml]
INFO: Sensor YAML Sensor [yaml] (done) | time=4726ms
INFO: Sensor Python Sensor [python]
WARN: No explicit support for version 3.11. Python version has been set to 3.10.
INFO: The cache version has changed since the previous analysis, cached data will not be used during this analysis. Retrieved: "~REDACTED~". Current version: "~REDACTED~".
INFO: Starting global symbols computation
INFO: 2 source files to be analyzed
INFO: 2/2 source files have been analyzed
INFO: Starting rules execution
INFO: 2 source files to be analyzed
INFO: 2/2 source files have been analyzed
INFO: The Python analyzer was able to leverage cached data from previous analyses for 0 out of 2 files. These files were not parsed.
INFO: Sensor Python Sensor [python] (done) | time=1346ms
INFO: Sensor Cobertura Sensor for Python coverage [python]
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=40ms
INFO: Sensor PythonXUnitSensor [python]
INFO: Sensor PythonXUnitSensor [python] (done) | time=28ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor ShellCheck Sensor [shellcheck]
INFO: ShellCheck version:
INFO: ShellCheck - shell script analysis tool
INFO: version: 0.8.0
INFO: license: GNU General Public License, version 3
INFO: website: https://www.shellcheck.net
INFO: Sensor ShellCheck Sensor [shellcheck] (done) | time=2446ms
INFO: Sensor JavaScript inside YAML analysis [javascript]
INFO: No input files found for analysis
INFO: Hit the cache for 0 out of 0
INFO: Miss the cache for 0 out of 0
INFO: Sensor JavaScript inside YAML analysis [javascript] (done) | time=38ms
INFO: Sensor CSS Rules [javascript]
INFO: Sensor CSS Rules is restricted to changed files only
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=4ms
INFO: Sensor Ruby Sensor [ruby]
INFO: Sensor Ruby Sensor is restricted to changed files only
INFO: 0 source files to be analyzed
java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" ClassLoader: ClassRealm{ruby}
	at org.joda.time.tz.ZoneInfoProvider.openResource(ZoneInfoProvider.java:225)
	at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:138)
	at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:97)
	at org.joda.time.DateTimeZone.getDefaultProvider(DateTimeZone.java:555)
	at org.joda.time.DateTimeZone.getProvider(DateTimeZone.java:449)
	at org.joda.time.DateTimeZone.forID(DateTimeZone.java:234)
	at org.joda.time.DateTimeZone.getDefault(DateTimeZone.java:169)
	at org.joda.time.chrono.ISOChronology.getInstance(ISOChronology.java:79)
	at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:97)
	at org.joda.time.DateTime.<init>(DateTime.java:209)
	at org.jruby.util.log.OutputStreamLogger.formatMessage(OutputStreamLogger.java:146)
	at org.jruby.util.log.StandardErrorLogger.write(StandardErrorLogger.java:58)
	at org.jruby.util.log.OutputStreamLogger.warn(OutputStreamLogger.java:67)
	at org.jruby.util.io.FilenoUtil$ReflectiveAccess.<clinit>(FilenoUtil.java:278)
	at org.jruby.util.io.FilenoUtil.getFilenoUsingReflection(FilenoUtil.java:143)
	at org.jruby.util.io.FilenoUtil.filenoFrom(FilenoUtil.java:139)
	at org.jruby.util.io.ChannelFD.initFileno(ChannelFD.java:51)
	at org.jruby.util.io.ChannelFD.<init>(ChannelFD.java:37)
	at org.jruby.util.io.ChannelFD.<init>(ChannelFD.java:47)
	at org.jruby.util.io.OpenFile.setChannel(OpenFile.java:195)
	at org.jruby.RubyIO.prepIO(RubyIO.java:263)
	at org.jruby.RubyIO.prepStdio(RubyIO.java:192)
	at org.jruby.RubyGlobal.initSTDIO(RubyGlobal.java:314)
	at org.jruby.RubyGlobal.createGlobals(RubyGlobal.java:228)
	at org.jruby.Ruby.<init>(Ruby.java:513)
	at org.jruby.Ruby.newInstance(Ruby.java:716)
	at org.jruby.javasupport.JavaEmbedUtils.initialize(JavaEmbedUtils.java:79)
	at org.jruby.javasupport.JavaEmbedUtils.initialize(JavaEmbedUtils.java:69)
	at org.sonarsource.ruby.converter.RubyConverter.initializeRubyRuntime(RubyConverter.java:182)
	at org.sonarsource.ruby.converter.RubyConverter.<init>(RubyConverter.java:75)
	at org.sonarsource.ruby.converter.RubyConverter.<init>(RubyConverter.java:82)
	at org.sonarsource.ruby.plugin.RubySensor.astConverter(RubySensor.java:45)
	at org.sonarsource.slang.plugin.SlangSensor.execute(SlangSensor.java:201)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	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:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2023-09-19T19:18:00.186Z [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
INFO: 0/0 source files have been analyzed
INFO: Sensor Ruby Sensor [ruby] (done) | time=3127ms

And adding those two --add-opens to SONAR_SCANNER_OPTS makes the error go away!

SONAR_SCANNER_OPTS=–add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.