Open GoogleCodeExporter opened 9 years ago
This may be a JVM issue, GeoffH also reports:
I've seen something similar, but ONLY under the following conditions
a) running at a Windows command prompt and launching with Maven 2
b) JAVA_HOME set to C:\Program Files (x86)\IBM\SDP70\jdk
I then get a stack trace that looks similar (although I'm using
Mockito)
-------------------------------------------------------------------------------
Test set: my.pkg.FinalCLassMockTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.234
sec <<< FAILURE!
testCreateMockDummy(my.pkg.FinalCLassMockTest) Time elapsed: 0.157
sec <<< ERROR!
java.lang.NoClassDefFoundError: my.pkg.DummyClass$
$EnhancerByMockitoWithCGLIB$$b85681c3
at sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance
(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
at
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance
(SunReflectionFactoryInstantiator.java:40)
at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:59)
at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy
(ClassImposterizer.java:120)
at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise
(ClassImposterizer.java:60)
at
org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocati
onControl
(MockCreator.java:79)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock
(MockCreator.java:53)
at org.powermock.api.mockito.PowerMockito.mock(PowerMockito.java:80)
at my.pkg.FinalCLassMock.createMockDummyClass(FinalCLassMock.java:56)
F:\Download\CodeSamples\MinimalPowerMockTest>java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
pwi32dev-20061002a (SR3))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32
j9vmwi3223-20061001 (JIT enabled)
J9VM - 20060915_08260_lHdSMR
JIT - 20060908_1811_r8
GC - 20060906_AA)
JCL - 20061002
It also fails in Eclipse when the JRE is
C:\Program Files (x86)\IBM\SDP70\jdk\jre
I don't get this when I use:
a) JAVA_HOME=C:\Program Files (x86)\Java\jdk1.5.0_21
b) on unix under AIX
java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
pap64devifx-20090225 (SR9-0 +IZ44410+IZ44495))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64
j9vmap6423ifx-20090225 (JIT enabled)
J9VM - 20090224_30451_BHdSMr
JIT - 20081112_1511ifx1_r8
GC - 200811_07)
JCL - 20081129
Original comment by johan.ha...@gmail.com
on 27 Nov 2009 at 10:50
Both stacktraces seems to be related to objenesis. We could try to upgrade to
the
latest version (1.2) or try Spring's version of objenesis.
Original comment by johan.ha...@gmail.com
on 27 Nov 2009 at 10:51
Objenesis doesn't seem to be the problem. From GeoffH:
F:\Tools\Objenesis>java -jar objenesis-tck-1.2.jar
Running TCK on platform: Java 1.5 (IBM Corporation IBM J9 VM 2.3
pwi32dev-20061002a (SR3))
Not serializable parent constructor called: Y
Objenesis
serializer Objenesis std
Constructor throwing exception N/
A Y
Constructor throwing exception (serializable)
Y Y
Constructor with arguments N/
A Y
Constructor with arguments (serializable)
Y Y
Constructor with mandatory arguments N/
A Y
Constructor with mandatory arguments (serializable)
Y Y
Default package constructor N/
A Y
Default package constructor (serializable)
Y Y
Default private constructor N/
A Y
Default private constructor (serializable)
Y Y
Default protected constructor N/
A Y
Default protected constructor (serializable)
Y Y
Default public constructor N/
A Y
Default public constructor (serializable)
Y Y
No constructor N/
A Y
No constructor (serializable)
Y Y
Serializable replacing with another class
Y Y
Serializable resolving to another class
Y Y
Serializable with ancestor throwing exception N/
A Y
--- SUCCESSFUL: TCK tests passed without errors in 47 ms
I also updated my pom.xml to Objenesis version 1.2 and launched via
Maven 2 using IBM J9 JVM
- I still got the same stack trace
Original comment by johan.ha...@gmail.com
on 27 Nov 2009 at 3:09
We had a similar problem with EasyMock and CGLib and Maven and we ended up
creating a
really ugly hack to get around it in our MockClassloader. Perhaps we can try
doing
something similar with this until we find time to find the real cause.
Original comment by johan.ha...@gmail.com
on 27 Nov 2009 at 3:10
Tried out the ugly fix and GeoffH reported that it didn't solve the issue. Need
more
input in order to fix this.
Original comment by johan.ha...@gmail.com
on 9 Dec 2009 at 9:46
I am getting the same error, but in a different method:
Caused by: java.lang.NoClassDefFoundError: org/objenesis/Objenesis
at
org.powermock.api.easymock.PowerMock.createPartialMockForAllMethodsExcept(PowerM
ock.java:365)
Original comment by pej...@gmail.com
on 15 Apr 2010 at 1:11
Aren't you just missing the Objenesis 1.2 jar in the classpath?
Original comment by johan.ha...@gmail.com
on 16 Apr 2010 at 5:52
No input from user in a long time.
Original comment by johan.ha...@gmail.com
on 22 Jul 2010 at 9:25
I get this stacktrace when I run one of my unit tests on only one of two
computers. No problem on the other one.
Both are running Ubuntu Linux with the exact same JDK version (1.6.0_19). The
classpath is exactly the same. The only difference I have found is that the
computer with the error has a 64-bit processor, whereas the other one is 32
bit.
Would be nice if someone else could prove or discard this theory.
Original comment by marterl...@gmail.com
on 10 Aug 2010 at 12:38
Yeah it would.. Really hard to tell what's causing this.
Original comment by johan.ha...@gmail.com
on 13 Aug 2010 at 1:25
Original comment by johan.ha...@gmail.com
on 10 Apr 2011 at 12:52
I got the same error using IBM Rational Application Developer (RAD).
By default the workspace uses the WebSphere JRE runtime. Once I pointed it to
the IBM JDK everything worked as expected.
Original comment by s...@nanosn.com
on 15 Dec 2011 at 12:10
Original issue reported on code.google.com by
johan.ha...@gmail.com
on 26 Nov 2009 at 7:06