cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

when I run Junit test class i am facing NoClassDefFoundError: CustomerModel even after ant clean all and .class file is generated successfully.

Former Member
0 Kudos
468

when I run Junit test class i am facing NoClassDefFoundError: CustomerModel even after ant clean all and .class file is generated successfully.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I am facing NoClassDefinitionFoundError when I run Junit test class even after .class file is generated , classpath is added to the build path please provide the solution.

Former Member
0 Kudos

I have found using:

 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations =
         {
                 "classpath:/global-servicelayer-spring.xml",
                 "classpath:/global-core-spring.xml"
         }
 

In your unit test helps to define where CustomerModel is instantiated. Make sure you use the correct spring config file where you are instantiating it.

sachinsaxena_1
Explorer
0 Kudos

Please make sure the classes are generated in the right folder. You get classnotfound exception when JVM cant find the class at specified location.