I am running a Java REST web service Google AppEngine. It runs great on my local Google Plugin for Eclipse development server. However, after it is deployed to the AppEngine Cloud, I get the following error that repeatedly is logged every 4 milliseconds:
com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General, could not be instantiated. Processing will continue but the class will not be utilized
This is the same issue as:
Jersey error on Google App Engine
However, the solution arrived at there is not working for me. The solution was “adding the jackson*.jar libs the problem is gone.” I did add all the Jackson jars as $ECLIPSE_PROJECT_HOME/war/WEB-INF/lib/jackson-all-1.9.7.jar , but I still get the error. I understand the nature of the problem (Jackson isn’t being detected as a Provider by Jersey), but I find interesting that this error only occurs once deployed, not in development.
Perhaps I’ll try the new 2.0.0 series of Jackson…
Do I need to add anything referring to Jackson to my $ECLIPSE_PROJECT_HOME/war/WEB-INF/web.xml file? Right now, I have:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>jerseywebapp</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>org.pathways.openciss.rest.impl</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.classnames</param-name>
<param-value>org.codehaus.jackson.jaxrs.JacksonJsonProvider</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jerseywebapp</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>OpenCISS.html</welcome-file>
</welcome-file-list>
</web-app>
I’ve tried it with and without the POJOMappingFeature and JacksonJsonProvider params turned on and off, to no avail…
Thanks in advance for any advice.
Solved. I was using Jackson libraries not bundled with Jersey. I removed the Jackson libraries and just installed the Jersey archive containing Jackson from:
http://maven.java.net/service/local/artifact/maven/redirect?r=releases&g=com.sun.jersey&a=jersey-archive&v=1.12&e=zip
… which is linked off the website:
http://jersey.java.net/nonav/documentation/latest/chapter_deps.html
The Jersey archive (currently v. 1.12) worked great. Once I added all the jars in its
/libfolder, the errors went away, as the other poster saw. What I wasn’t understanding was that only Jersey archives should be used, not a mix of jars from the Jersey and Jackson web sites, since the Jersey archive contains Jackson jars.