Ubuntu Linux 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
Apache Maven 3.5.2
Steps to Reproduce
Switch to Java 8u171 or later.
Check out wrensec-commons on the feature/upgrade-mockito branch.
Attempt to build CSV audit with mvn clean install -DignoreArtifactSigs.
Expected Results
Project builds successfully.
Tests complete successfully.
Actual Results
Tests fail with the following error:
[ERROR] Tests run: 8, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 5.213 s <<< FAILURE! - in TestSuite
[ERROR] testContextLoading(org.forgerock.audit.handlers.jms.JndiJmsContextManagerTest) Time elapsed: 2.472 s <<< FAILURE!
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: interface javax.naming.Context.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java : 1.8
JVM vendor name : Oracle Corporation
JVM vendor version : 25.181-b13
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13
JVM info : mixed mode
OS name : Linux
OS version : 4.15.0-39-generic
Underlying exception : java.lang.IllegalStateException: Error invoking java.lang.ClassLoader#defineClass
at org.forgerock.audit.handlers.jms.JndiJmsContextManagerTest.testContextLoading(JndiJmsContextManagerTest.java:85)
Caused by: java.lang.IllegalStateException: Error invoking java.lang.ClassLoader#defineClass
at org.forgerock.audit.handlers.jms.JndiJmsContextManagerTest.testContextLoading(JndiJmsContextManagerTest.java:85)
Caused by: java.lang.NoClassDefFoundError: javax/naming/Context
at org.forgerock.audit.handlers.jms.JndiJmsContextManagerTest.testContextLoading(JndiJmsContextManagerTest.java:85)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]
Mockito cannot mock this class: interface javax.naming.Context.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java : 1.8
JVM vendor name : Oracle Corporation
JVM vendor version : 25.181-b13
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13
JVM info : mixed mode
OS name : Linux
OS version : 4.15.0-39-generic
Underlying exception : java.lang.IllegalStateException: Error invoking java.lang.ClassLoader#defineClass
[INFO]
[ERROR] Tests run: 8, Failures: 1, Errors: 0, Skipped: 7
Additional Notes
The class indicated javax.naming.context is part of the JDK and is always in the classpath. Therefore, this error must have something to do with class validation or other components of class loading that Bytebuddy (what Mockito uses for code generation) works with.
Affected Versions
feature/upgrade-mockito
Build Environment
Steps to Reproduce
feature/upgrade-mockito
branch.mvn clean install -DignoreArtifactSigs
.Expected Results
Actual Results
Tests fail with the following error:
Additional Notes
The class indicated
javax.naming.context
is part of the JDK and is always in the classpath. Therefore, this error must have something to do with class validation or other components of class loading that Bytebuddy (what Mockito uses for code generation) works with.