Errors$ErrorMessagesException when using Jersey in Java

Viewed 26135

I am using Jersy to develeop REST webservices, this is my simple code:

@GET
@Path("/retrieveCustomerInformation/{jsonString}")
@Produces(MediaType.APPLICATION_JSON)
public String retrieveCustomerInformation(@PathParam("jsonString")JSONObject jsonObject) 
    throws Exception  {
      //Other codes here

    }

But when I ping the rest service url from browser, I am getting below exception:

javax.servlet.ServletException: Servlet.init() for servlet jersey-serlvet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

and the root cause is:

com.sun.jersey.spi.inject.Errors$ErrorMessagesException
com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)

Can someone guide me, what causes this error? I am finding difficult to understand this error message as it doesn't provide any useful information to debug.

This is my web.xml

<servlet>
    <servlet-name>jersey-serlvet</servlet-name>
    <servlet-class>
                 com.sun.jersey.spi.container.servlet.ServletContainer
            </servlet-class>
    <init-param>
         <param-name>com.sun.jersey.config.property.packages</param-name>
         <param-value>com.test/param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>jersey-serlvet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

I am using Jersey 1.8, JDK 1.7 and App is running on Tomcat 7.0. If required I can provide more information.

4 Answers
Related