index.html
<html>
<body>
<h2>Jersey RESTful Web Application!</h2>
<p><a href="webresources/myresource">Jersey resource</a>
<p>Visit the <a href="http://jersey.java.net">Project Jersey website</a>
for more information on Jersey!
</body>
</html>
MyResource.java
@Path("/myresource")
public class MyResource {
/** Method processing HTTP GET requests, producing "text/plain" MIME media
* type.
* @retu String that will be send back as a response of type "text/plain".
*/
@GET
@Produces("text/plain")
public String getIt() {
retu "Hi there!";
}
}
Error is Comming
HTTP Status 500 - Servlet.init() for servlet Jersey Web Application threw exception
--------------------------------------------------------------------------------
type Exception report
message Servlet.init() for servlet Jersey Web Application threw exception
description The server encountered an inteal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet Jersey Web Application threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
org.apache.catalina.coector.CoyoteAdapter.service(CoyoteAdapter.java:423)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
org.apache.coyote.AbstractProtocol$AbstractCoectionHandler.process(AbstractProtocol.java:625)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRuable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
root cause
java.lang.NoSuchMethodError: com.sun.jersey.core.reflection.ReflectionHelper.getContextClassLoaderPA()Ljava/security/PrivilegedAction; com.sun.jersey.spi.scaing.AotationScaerListener.(AotationScaerListener.java:94) com.sun.jersey.spi.scaing.PathProviderScaerListener.(PathProviderScaerListener.java:59) com.sun.jersey.api.core.ScaingResourceConfig.init(ScaingResourceConfig.java:79) com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104) com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:78) com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:89) com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:696) com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:674) com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:205) com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) org.apache.catalina.coector.CoyoteAdapter.service(CoyoteAdapter.java:423) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) org.apache.coyote.AbstractProtocol$AbstractCoectionHandler.process(AbstractProtocol.java:625) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRuable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.67 logs.
