Java runtime issues with 2.0.0 release of github action

Hi,

I was wondering if folks had seen the issues being reported here: Sonar scan not work anymore after release v2.0.0 last night · Issue #80 · SonarSource/sonarqube-scan-action · GitHub

Since the release of the 2.x release many uses, including myself are getting crashes during the analyzer runs.

I’m trying to scan typescript code, and my actions are set up like:

name: 'build-test'
# rebuild any PRs and main branch changes
on:
  pull_request:
  push:
    branches:
      - main
      - 'releases/*'

jobs:
  # make sure build/ci work properly
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: |
          npm ci
      - run: |
          npm run all
  # make sure the action works on a clean machine without building
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - run: |
          npm ci
          npm run test -- --coverage

      - name: Sonar scan (PR)
        id: sonar-scan-pr
        if: always() && github.event_name == 'pull_request'
        uses: sonarsource/sonarqube-scan-action@master
        env:
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
        with:
          args: >
            -Dsonar.pullrequest.key=${{ github.event.number }}
            -Dsonar.pullrequest.branch=${{ github.HEAD_REF }}
            -Dsonar.pullrequest.base=${{ github.BASE_REF }}
            -Dsonar.pullrequest.github.repository=${{ github.repository }}
            -Dsonar.scm.provider=git

      - name: Sonar scan (main)
        id: sonar-scan-master
        if: github.ref == 'refs/heads/main'
        uses: sonarsource/sonarqube-scan-action@master
        env:
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
        with:
          args: >
            -Dsonar.branch.name=main
            -Dsonar.scm.provider=git

      - name: Sonar quality gate
        uses: sonarsource/sonarqube-quality-gate-action@master
        timeout-minutes: 5
        env:
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}

The error i get during the pr gate is:

java.lang.ExceptionInInitializerError
	at com.B.A.B.A.D.<init>(Unknown Source)
	at com.sonarsource.tsql.B.F.Q.<init>(Unknown Source)
	at com.sonarsource.tsql.plugin.B.<init>(Unknown Source)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:606)
	at org.picocontainer.DefaultPicoContainer.getComponents(DefaultPicoContainer.java:587)
	at org.sonar.core.platform.ComponentContainer.getComponentsByType(ComponentContainer.java:291)
	at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.completeScannerExtensions(AbstractExtensionDictionnary.java:82)
	at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.getExtensions(AbstractExtensionDictionnary.java:77)
	at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.getFilteredExtensions(AbstractExtensionDictionnary.java:67)
	at org.sonar.scanner.sensor.ModuleSensorExtensionDictionnary.selectSensors(ModuleSensorExtensionDictionnary.java:40)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$0(ModuleSensorsExecutor.java:52)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:52)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	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)
Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @939ff41
	at net.sf.cglib.core.ReflectUtils.defineClass(Unknown Source)
	at net.sf.cglib.core.AbstractClassGenerator.generate(Unknown Source)
	at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(Unknown Source)
	at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(Unknown Source)
	at net.sf.cglib.core.internal.LoadingCache$2.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at net.sf.cglib.core.internal.LoadingCache.createEntry(Unknown Source)
	at net.sf.cglib.core.internal.LoadingCache.get(Unknown Source)
	at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(Unknown Source)
	at net.sf.cglib.core.AbstractClassGenerator.create(Unknown Source)
	at net.sf.cglib.core.KeyFactory$Generator.create(Unknown Source)
	at net.sf.cglib.core.KeyFactory.create(Unknown Source)
	at net.sf.cglib.core.KeyFactory.create(Unknown Source)
	at net.sf.cglib.proxy.Enhancer.<clinit>(Unknown Source)
	... 50 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @939ff41
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at net.sf.cglib.core.ReflectUtils$1.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at net.sf.cglib.core.ReflectUtils.<clinit>(Unknown Source)
	at net.sf.cglib.core.KeyFactory$Generator.generateClass(Unknown Source)
	at net.sf.cglib.core.DefaultGeneratorStrategy.generate(Unknown Source)
	... 63 more
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Any hints?

Hey there

What version of SonarQube are you using? It should be located in the footer of your SonarQube instance.

Take a look here.

Yeah, we’re out of date. Great call. Will get that fixed up.

1 Like

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