Embedded tomcat ClassDefNotFound exception sometimes?

49 Views Asked by At

I have 2 maven projects A and B. Project A is a dependency of project b. I can access everything in project A while compiling. When I tomcat:run my project b through maven tomcat plugin i get classdefnotfoundexception but once a day after clean-installing projects many times it works until i make a tiny change in project a then it starts giving me the exceptions for hours.

What is the reason of this and why does it work sometimes?

EDIT Here's what i get in spring 2, if i use spring 4 its the same error but instead it says ClassDefNotFoundException.

SEVERE: Allocate exception for servlet spring-ws
java.lang.Error: Unresolved compilation problems: 
The import com.test.projecta.ClassOne cannot be 
resolved
The import com.test.projecta.ClassTwo cannot be 
resolved
...

Adding projecta in pom.xml

<dependency>
        <groupId>prx</groupId>
        <artifactId>projecta</artifactId>
        <version>1.0.0.11-SNAPSHOT</version>
</dependency>

I can access the imports when writing the code and like I said the project works sometimes after clean-installing many times. Could it be a classloader issue?

EDIT 2 I still get the same error but now only the JAXB class imports are giving me the error. Project A is using maven-jaxb2-plugin to generate classes from xsd. and target/generated-sources/xjc folder is in the build path.

0

There are 0 best solutions below