Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute tests with AdoptOpenJDK 8 #118

Open
dagutten opened this issue Feb 16, 2022 · 0 comments
Open

Unable to execute tests with AdoptOpenJDK 8 #118

dagutten opened this issue Feb 16, 2022 · 0 comments

Comments

@dagutten
Copy link

dagutten commented Feb 16, 2022

Hi,

I am facing exactly the same issue reported in: #108

When executing mvn clean verify on: https://github.com/ExpediaGroup/jenkins-spock/tree/master/examples/shared-library


Error:

`Feb 16, 2022 2:15:21 PM jenkins.model.Jenkins
SEVERE: Failed to load Jenkins.class
java.lang.ExceptionInInitializerError
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:811)
at com.thoughtworks.xstream.XStream.(XStream.java:574)
at com.thoughtworks.xstream.XStream.(XStream.java:496)
at com.thoughtworks.xstream.XStream.(XStream.java:465)
at com.thoughtworks.xstream.XStream.(XStream.java:411)
at com.thoughtworks.xstream.XStream.(XStream.java:350)
at hudson.util.XStream2.(XStream2.java:100)
at jenkins.model.Jenkins.(Jenkins.java:5091)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:185)
at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
at java.base/java.lang.reflect.Field.set(Field.java:799)
at org.codehaus.groovy.reflection.CachedField.setProperty(CachedField.java:74)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2689)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3770)
at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:199)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:484)
at com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification.setupSpec(JenkinsPipelineSpecification.groovy:1101)
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.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:188)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:84)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.doRunSetupSpec(BaseSpecRunner.java:180)
at org.spockframework.runtime.BaseSpecRunner$3.invoke(BaseSpecRunner.java:164)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runSetupSpec(BaseSpecRunner.java:157)
at org.spockframework.runtime.BaseSpecRunner.doRunSetupSpec(BaseSpecRunner.java:177)
at org.spockframework.runtime.BaseSpecRunner$3.invoke(BaseSpecRunner.java:164)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runSetupSpec(BaseSpecRunner.java:157)
at org.spockframework.runtime.BaseSpecRunner.runSetupSpec(BaseSpecRunner.java:152)
at org.spockframework.runtime.BaseSpecRunner.doRunSpec(BaseSpecRunner.java:97)
at org.spockframework.runtime.BaseSpecRunner$1.invoke(BaseSpecRunner.java:84)
at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:481)
at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:464)
at org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:76)
at org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:67)
at org.spockframework.runtime.Sputnik.run(Sputnik.java:63)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @32da56f4
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.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.(TreeMapConverter.java:50)
... 55 more

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.08 s <<< FAILURE! - in DefaultPipelineSpec
[ERROR] DefaultPipelineSpec Time elapsed: 1.079 s <<< ERROR!
java.lang.ExceptionInInitializerError
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @32da56f4

[INFO] Running DeployerSpec
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 s <<< FAILURE! - in DeployerSpec
[ERROR] DeployerSpec Time elapsed: 0.001 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class jenkins.model.Jenkins`


My environment is using java 8 Adopt Open JDK:

shared-library % java -version openjdk version "1.8.0_282" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)

Is Jenkins spock compatible with AdoptOpenJDK 1.8?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant