Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NoClassDefFoundError problem

royce.comApr 25 2011 — edited Apr 25 2011
Hi again friends,

I'm using JDEV to develop OAF, I have no problem doing unit test with Mockito, and Junit 3.x. JUnit 3 is the officially supported version for my IDE build.

I wanted to use JUnit 4, so I decided to just run my tests using ant build file. Everything compiled fine after adding the jar/zip files from jdev one after another in the ant classpath.

But when I try to run the unit test, I am getting this NoClassDefFoundError apparently from a class file is I already included in the build file. The method call having problem same version jar file Mockito.
   [junit] java.lang.NoClassDefFoundError: oracle/adf/mds/repos/DatabaseContext

   [junit]     at java.lang.Class.getDeclaredConstructors0(Native Method)
   [junit]     at java.lang.Class.privateGetDeclaredConstructors(Class.java:238
)
   [junit]     at java.lang.Class.getDeclaredConstructors(Class.java:1836)
   [junit]     at org.mockito.internal.creation.jmock.ClassImposterizer.setCons
ructorsAccessible(ClassImposterizer.java:58)
   [junit]     at org.mockito.internal.creation.jmock.ClassImposterizer.imposte
ise(ClassImposterizer.java:53)
   [junit]     at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:5
)
   [junit]     at org.mockito.internal.MockitoCore.mock(MockitoCore.java:45)
   [junit]     at org.mockito.Mockito.mock(Mockito.java:921)
   [junit]     at org.mockito.Mockito.mock(Mockito.java:816)
Please share some ideas, thanls.

I'll try to see what happens If I use JUnit3.0 in with ant... Same error.

Maybe while the Class in question is being instantiated, it silently depend on another class that is not present in my classpath...That's exactly the case, solved by including all jar files defined for the project in jdev.

Sorry for the monologue.

Edited by: thedatawarehouse on Apr 25, 2011 4:34 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2011
Added on Apr 25 2011
1 comment
1,001 views