简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM