2

我最近将球衣添加到我的应用程序引擎项目中,在我的本地计算机上一切正常,但是当我尝试访问已部署站点上的页面时出现错误。我想我可能会包括一个不受支持的课程,但我认为我没有使用任何课程。我的大部分代码都是本指南中设置jQuery 上传的精确副本

这是我的代码:

@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();
}

网页.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)

    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)
    at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
    at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)

    com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.atom.rome.impl.provider.entity.AtomFeedProvider, 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.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)
    at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
    at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
    at com.sun.jersey.core.spi.factory.MessageBodyFactory.initWriters(MessageBodyFactory.java:207)
    at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:163)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1310)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168)

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)
4

1 回答 1

4

您需要添加

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

到 web.xml

这可以防止使用反射的类,这在应用引擎上是不允许的。

于 2013-01-14T17:14:21.203 回答