Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 应用程序引擎上的Jersey设置_Java_Google App Engine_Jersey - Fatal编程技术网

Java 应用程序引擎上的Jersey设置

Java 应用程序引擎上的Jersey设置,java,google-app-engine,jersey,Java,Google App Engine,Jersey,我最近将jersey添加到我的app engine项目中,在我的本地机器上一切都很好,但是当我尝试访问部署站点上的页面时,我会出错。我想我可能包含了一个不受支持的类,但我认为我没有使用任何类。我的大部分代码都是本安装指南的精确副本 这是我的密码: @GET @Path("/url") public Response getCallbackUrl() { /* this is /_ah/upload and it redirects to its given path */ String

我最近将jersey添加到我的app engine项目中,在我的本地机器上一切都很好,但是当我尝试访问部署站点上的页面时,我会出错。我想我可能包含了一个不受支持的类,但我认为我没有使用任何类。我的大部分代码都是本安装指南的精确副本

这是我的密码:

@GET
@Path("/url")
public Response getCallbackUrl() {
  /* this is /_ah/upload and it redirects to its given path */
  String url = blobstoreService.createUploadUrl("/rest/file");
  return Response.ok(new FileUrl(url), MediaType.APPLICATION_JSON).build();
}
web.xml:

<servlet>
    <servlet-name>jersey</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.thedailycaption</param-value>
    </init-param>
    <init-param>
           <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
         <param-value>true</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>jersey</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
以下是我得到的错误:

Uncaught exception from servlet
java.lang.NullPointerException
    at com.sun.jersey.spi.container.ContainerRequest.<init>(ContainerRequest.java:188)
    at com.sun.jersey.spi.container.servlet.WebComponent.createRequest(WebComponent.java:450)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:380)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.thedailycaption.Controller.FacebookLogin.doFilter(FacebookLogin.java:165)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:102)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
以下是启动时的错误:

java.lang.SecurityException: Unable to get members for class com.sun.jersey.atom.rome.impl.provider.entity.AtomFeedProvider
at com.google.appengine.runtime.Request.process-51d788e4ae40f0dc(Request.java)
at java.lang.Class.getDeclaredMethods(Class.java:253)
at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:131)
at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:123)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)

您需要添加

<init-param>
    <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
    <param-value>true</param-value>
</init-param>
到web.xml

这将阻止使用反射的类,这在应用程序引擎上是不允许的

您需要添加

<init-param>
    <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
    <param-value>true</param-value>
</init-param>
到web.xml


这将阻止使用反射的类,这在应用程序引擎上是不允许的

你能发布你的web.xml让我们看到jersey servlet映射吗?你能发布你的web.xml让我们看到jersey servlet映射吗?
com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.atom.rome.impl.provider.entity.AtomEntryProvider, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.SecurityException: Unable to get members for class com.sun.jersey.atom.rome.impl.provider.entity.AtomEntryProvider
    at com.google.appengine.runtime.Request.process-51d788e4ae40f0dc(Request.java)
    at java.lang.Class.getDeclaredMethods(Class.java:253)
    at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
    at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
    at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:131)
    at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:123)
    at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
    at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
    at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
Uncaught exception from servlet
java.lang.ExceptionInInitializerError
    at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:83)
    at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:176)
    at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.optimize(Accessor.java:282)
    at com.sun.xml.bind.v2.runtime.property.ArrayProperty.<init>(ArrayProperty.java:69)
    at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.<init>(ArrayERProperty.java:88)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.<init>(ArrayElementProperty.java:100)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.<init>(ArrayElementNodeProperty.java:62)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:33)
<init-param>
    <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
    <param-value>true</param-value>
</init-param>