简体   繁体   中英

How to references correctly Java Projects into Web Dynamic Project

I have an eclipse Java Project MyProject with the package com.myproj , that uses some libraries: xstream and jfreechart . I have also an eclipse Web Dynamic Project WebProject with the package com.webproj , that depends on some classes in com.myproj and that uses the library jfreechart .

The MyProject works perfectly.

In the Java Build Path of the WebProject there is the MyProject , and MyProject is also in the Deployment Assembly.

But every time I run the WebProject it can't start because of an ClassNotFoundException related to xstream , after this:

java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)

Now add all the XStream related dependencies, which are present in your Java project, in your web project as well.

When you run WebProject, make sure that is also build the dependent projects (MyProject). My guess is that it only cleans the projects.

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