title: java.lang.NoClassDefFoundError: In Rest API JAVA
body: <p>I am Using a project1's class in another Rest API Project2 in Eclipse.
  I have added that project1 to rest api project2's Build Path Still I am getting this Exception:</p>
  
  <p>Code I have Used :</p>
  
  <pre><code>@Path("/studentreq/json")
      @Consumes({ MediaType.APPLICATION_JSON })
      @Produces({ MediaType.APPLICATION_JSON })
      public Response requestBasicReport(Student stu) {
          OperationResult operationResult = new OperationResult();
          boolean responseFlag = false;
          try {
              if (operationResult.isSuccessful()) {
                  responseFlag = true;
              } else {
                  responseFlag = false;
                  // send a message
              }
          } catch (Exception ex) {
              responseFlag = false;
          } finally {
              // nullify objects
              if (responseFlag) {
                  return Response.ok(stu).build(); //put the required object in ok(object)
              } else {
                  return Response.serverError().build();
              }
          }
      }
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/7.0.40 - Error report&lt;/title&gt;&lt;style&gt;&lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 500 - java.lang.NoClassDefFoundError: org/project/common/OperationResult&lt;/h1&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Exception report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;java.lang.NoClassDefFoundError: org/project/common/OperationResult&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;The server encountered an internal error that prevented it from fulfilling this request.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;exception&lt;/b&gt; &lt;pre&gt;javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/project/common/OperationResult
      com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  &lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;root cause&lt;/b&gt; &lt;pre&gt;java.lang.NoClassDefFoundError: org/project/common/OperationResult
      org.project.basil.service.ReportRequest.requestBasicReport(ReportRequest.java:131)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
      com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  </code></pre>