我正在運行Java REST Web服務Google AppEngine。它在我的本地Google Plugin for Eclipse開發服務器上運行良好。但是,它被部署到AppEngine上雲後,我收到以下錯誤重複每4毫秒記錄:
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
這是相同的問題:
Jersey error on Google App Engine
然而,解決方案抵達沒有爲我工作。解決方案是「添加jackson * .jar庫,問題消失了。」我確實添加了所有Jackson jar作爲$ ECLIPSE_PROJECT_HOME/war/WEB-INF/lib/jackson-all-1.9.7.jar,但仍然出現錯誤。我瞭解問題的本質(傑克遜並未被Jersey檢測爲供應商),但我覺得這個錯誤只會在部署後纔會發生,而不是在開發階段。
也許我會嘗試新的2.0.0系列傑克遜...
我需要什麼指傑克遜添加到我的$ ECLIPSE_PROJECT_HOME /戰爭/ WEB-INF/web.xml文件?現在,我有:
<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>
我一直有和沒有POJOMappingFeature和JacksonJsonProvider PARAMS嘗試過打開和關閉,無果......
先感謝您的任何意見。
更新版本(最新在2.x之前):http://maven.java.net/service/local/artifact/maven/redirect?r=releases&g=com.sun.jersey&a=jersey-archive&v=1.19&e=壓縮 –