Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web project doesn't run on server if a dependent project is opened in eclipse

I'm developing a web application with Eclipse 4.4.2, Maven and Tomcat v7.0. The application consists of a

  • AppSuite (<packaging>pom</packaging>)
  • AppModel (<packaging>jar</packaging>, has some auto-generated classes)
  • AppUserInterface (<packaging>war</packaging>, depends on AppModel)

AppUserInterface and AppModel are modules of the AppSuite.

The issue I'm currently facing is that if I have all three projects opened in Eclipse and I try to run the AppUserInterface on the server, everything gets moved to the tomcat webapps folder correctly (*.class files of the AppUserInterface and all the libs including AppModel.jar) but tomcat throws an exception

java.lang.NoClassDefFoundError: com/app/model/ClassName

But If I close the project AppModel in eclipse everything runs fine when I run AppUserInterface on the server.

I suspect that eclipse becomes confused If AppUserInterface shall work with the local AppModel.

Any thoughts to resolve this error, so that I can have all three projects open at the same time and still run AppUserInterface?


EDIT: The java.lang.NoClassDefFoundError: com/app/model/ClassName class is not an auto-generated class.

like image 600
Basti Funck Avatar asked Jun 26 '15 11:06

Basti Funck


1 Answers

Added the bounty and 2 mins later found the solution ...

The solution is the anwser of rmtheis in this topic Strange "java.lang.NoClassDefFoundError" in Eclipse which I hadn't found until now . A simple Project->Clean... solved this issue somehow.

like image 108
Basti Funck Avatar answered Sep 23 '22 23:09

Basti Funck