Simze Simze - 1 year ago 233
Java Question

Errors$ErrorMessagesException when using Jersey in Java

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

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

and the root cause is:


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



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

Answer Source

Your question seems to be a duplicate and has probably been appropriately addressed. I too had the same issue some time ago. Click here to see the accepted answer that resolved it for me

And in case you're reluctant to follow the link, first of all, try adding jersey-multipart.jar and mimepull.jar to your project libraries... And if your project is a Maven project, add the following dependencies to your pom.xml. The mimepull dependency should ship along with it.


Remember to ensure that the version of jersey-multipart that you use, is the same as the version of jersey that you're using in the project.

Just in case the above solution doesn't resolve your issue, you may want to see here for more useful tips too. Cheers!