Currently we are evaluating SonarCloud for Code Analysis and Code Review in our Bitbucket repository (Private) in node.js application. We need your help as we unable to add SonarCloud Scan in Bitbucket. We are getting the following error:
ERROR: Error during SonarScanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
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:566)
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:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
This is a very old image, that I’m not surprised doesn’t contain Java 17 (the error you’re facing is that only Java 11 is included, which isn’t supported as a SonarScanner runtime).
You should check the logs to see if this installation is even successful. If it is successful, I suggest adding another line to set the JAVA_HOME variable to this installation. For example:
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
Otherwise, I would suggest you use a newer image with a supported version of Node.
Now we are using the latest version of node in a new application, but we are getting some error. Please find error & yml file below:
ERROR: Error during SonarScanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
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:566)
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:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
✖ SonarCloud analysis failed. (exit code = 1)
We followed as suggested by you, however, still we are getting the error. Is it possible to schedule a google meet session for 10-15 minutes. Sharing the details once again:
ERROR: Error during SonarScanner execution
116
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
117
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
118
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
119
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
120
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
121
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
122
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
123
at java.base/java.security.AccessController.doPrivileged(Native Method)
124
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
125
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
126
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
127
at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
128
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
129
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
130
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
131
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
132
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
133
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
134
at com.sun.proxy.$Proxy0.execute(Unknown Source)
135
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
136
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
137
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
138
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
139
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
140
ERROR:
141
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
In addition to the above, sharing the current bitbucket pipeline YML, also for your reference we have tried 2x, 4x & 8x, but the problem remains the same
This is an open community with people volunteering their free time to provide assistance. We’re eager to contribute to the community, but you are not guaranteed a fast response.
Hi, Understood and am well aware of this.
Follow-up messages were only meant to seek help from the community and to resolve the issue which we are facing and wanted to move on…
Will look forward to the response.
Please note that increasing the Pipeline build step size to 2x, 4x, or 8x (using the size attribute) will not automatically increase the memory allocated to the Docker service container. Docker service with size 2x, 4x, or 8x will still be allocated 1GB of memory by default, unless you configure and allocate more memory explicitly in the YAML file (an example is given below)
…
We have checked, tried all the suggested options. However, the issue still persists.
Any help would be appreciated to start to add sonar scan in our bitbucket pipeline, using Sonar Cloud.
We have followed this link ( Unable to add SonarCloud Scan in Bitbucket - #14 by Colin ) as you have given us earlier.
We have already shared our pipeline and error in previous chat in the thread. Kindly let me know if anything else need to be shared with you, which can resolve this issue.