简体   繁体   中英

Eclipse+Java+Tomcat - How to setup dynamic web project to refer other java projects

I'm creating a web app, for which I have created a dynamic web project in Eclipse. I have also created two java projects, which serve different business purposes. I want my dynamic web project to use these projects as well.

Below are the projects i've created

  1. myapp-core (Java project that has all my core components)
  2. myapp-db (All classes related to DB calls go here)
  3. myappWeb (Dynamic web project which will have only presentation logic)

The point is, I've created all these projects and the classes within them. I have also added myapp-core and myapp-db projects to my myaddWeb's classpath, and am now free of any compilation errors.

However, when I deploy this on Tomcat, I get java.lang.ClassNotFoundException for org.slf4j.LoggerFactory

Now, all three projects have logging, for which I have added slf4j and logback related jars to the build paths of each project (separately).

All my projects are referencing common libraries, like guava, apache poi, etc., which I have associated with each project separately.

Am I missing anything here? Can anyone guide me what is the exact setup that needs to be done for such a framework?

Thanks Sriram

Please follow below mentioned steps for all 3 projects : 1. Right Click on your Project 2. Go to "Java EE Module Dependencies" option. 3. Select all jars and Apply changes.

If "Java EE Module Dependencies" is not there, try "Web Deployment Assembly" which does the same thing.

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