Tomcat + Jersey produces org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError
<p>I know this issue has been posted here before, but I can't seem to find an answer to my question.. </p>

<p>I'm trying to get Jersey from "ProjectA" to call a method in a POJO ("PojoClass"), which would instantiate an object from an imported class ("ForeignClass")and then call one of its own methods.. but I keep getting a NoClassDefFoundError error regarding ForeignClass. If I turn PojoClass to a Main, it finds ForeignClass with no problem and instantiates the object. is ForeignClass supposed to be imported into ProjectA's WEB-INF/lib somehow for Jersey to recognize it?</p>

<p>ProjectA's web.xml:</p>

<pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns="http://java.sun.com/xml/ns/javaee"   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
  &lt;display-name&gt;PackageA&lt;/display-name&gt;
 &lt;servlet&gt;
    &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
    &lt;init-param&gt;
        &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
        &lt;param-value&gt;PackageA&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</code></pre>

<p>PojoClass:</p>

<pre><code>import PackageB.ForeignClass;



@Path("/admin")
public class PojoClass {


    @GET
    public void test(){

        ForeignClass fc = new ForeignClass();
        fc.testRest(); // &lt;&lt; this method just prints "test"

    }

}
</code></pre>

<p>And then <a href="http://localhost:8080/ProjectA/rest/admin" rel="nofollow">http://localhost:8080/ProjectA/rest/admin</a> 
produces:  org.glassfish.jersey.server.ContainerException:  java.lang.NoClassDefFoundError: PackageB.ForeignClass</p>

<p>Thanks a lot,</p>