I'll have a lot to write about my experience with JEE and creating restful services later.
However, for now, I'd like to talk about the following problem that I've had twice:
After making some changes to the Resource files, I've started to get this response:
exception
javax.servlet.ServletException: Servlet.init() for servlet ServletAdaptor threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
java.lang.Thread.run(Thread.java:619)
root cause
java.lang.IllegalArgumentException: java.text.ParseException: End of header
com.sun.jersey.core.header.MediaTypes.createMediaTypes(MediaTypes.java:224)
com.sun.jersey.core.header.MediaTypes.createMediaTypes(MediaTypes.java:191)
com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addConsumes(IntrospectionModeller.java:152)
com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:338)
com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:120)
com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:623)
com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:114)
com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1013)
com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(WebApplicationImpl.java:153)
com.sun.jersey.server.impl.application.WebApplicationImpl$11.f(WebApplicationImpl.java:652)
com.sun.jersey.server.impl.application.WebApplicationImpl$11.f(WebApplicationImpl.java:649)
What the heck is that? The first time I fixed it by making a new project and redoing everything (!)
The second time, I tried restarting and copying all the Resources files from the old project to the new one. Turns out, it still messes up.
Later, I found that the problem is in the @Produces and @Consumes annotation.
For one of the services, I had written @Produces("x-www-form-urlencoded") instead of @Produces("application/x-www-form-urlencoded)
In conclusion, the root problem
java.lang.IllegalArgumentException: java.text.ParseException: End of header
is usually a stupid annotation problem.