Alberto
Alberto

Reputation: 2982

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)

Upvotes: 0

Views: 86

Answers (2)

Paul
Paul

Reputation: 163

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

Upvotes: 0

Dinal
Dinal

Reputation: 661

Right click your web project -> Properties -> Java build path -> Libraries -> Add Jars.

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

Upvotes: 1

Related Questions