java.lang.NoClassDefFoundError: In Rest API JAVA -
i using project1's class in rest api project2 in eclipse. have added project1 rest api project2's build path still getting exception:
code have used :
@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 message } } catch (exception ex) { responseflag = false; } { // nullify objects if (responseflag) { return response.ok(stu).build(); //put required object in ok(object) } else { return response.servererror().build(); } } }
exception:
<html><head><title>apache tomcat/7.0.40 - error report</title><style><!--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;}--></style> </head><body><h1>http status 500 - java.lang.noclassdeffounderror: org/project/common/operationresult</h1><hr size="1" noshade="noshade"><p><b>type</b> exception report</p><p><b>message</b> <u>java.lang.noclassdeffounderror: org/project/common/operationresult</u></p><p><b>description</b> <u>the server encountered internal error prevented fulfilling request.</u></p><p><b>exception</b> <pre>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) </pre></p><p><b>root cause</b> <pre>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)
problem has been solved have add project properties--> deployment assembly--> add--> project
Comments
Post a Comment