user2661408
user2661408

Reputation: 71

Java ClassNotFoundException under Tomcat in Eclipse

I have been all over existing posts that deal with the ClassNotFoundException running a Java web app under Tomcat in Eclipse.

I am unable to provide source code and configuration artifacts because I am working on a proprietary code base. However, through trial and error I have boiled the problem down to its basic elements.

I have project packaged by Maven as a WAR. There are a number of other projects in the workspace on which the primary package depends. This arrangement has been working fine: I can deploy the WAR and the JARs it depends on under a Tomcat instance in Eclipse and the application runs and I can debug it.

Now I have created a new project that for the moment contains a single public class with a public constructor. The maven build works fine and the Eclipse compile workspace works fine. However, when I deploy to Tomcat and exercise an execution path that instantiates the class in the new project, I get a ClassNotFoundException.

I have checked the following items:

Based on existing discussions of the ClassNotFoundException-in-Tomcat problem, these are the only things I have found to check. What else should I be looking into?

Thanks for your help.

Upvotes: 3

Views: 2396

Answers (2)

Bhavana Sornapudi
Bhavana Sornapudi

Reputation: 17

Even for me the same problem has occurred .... I have clean the Tomcat and the Tomcat work directory and run the project again it worked fine...

This may happen because of the cache, sometimes which is not cleaned properly while building the application.

sometimes deleting the project from the eclise and importing it again doing it from scratch will also clear the problem

Upvotes: 1

user2661408
user2661408

Reputation: 71

I'm not sure what exactly was wrong. However, I ended up resolving this issue by removing the project from the workspace, re-creating it from scratch, and importing my class into the re-created project.

Upvotes: 0

Related Questions