Resiteasy 3.5.0.Final on App Engine标准环境 - NoSuchFieldError SERVER_SENT_EVENTS_TYPE

时间:2018-04-17 06:08:56

标签: java rest google-app-engine resteasy

我有一个非常基本的Java8应用程序,它使用在App Engine标准环境中部署的Resteasy 3.1.4.Final

但是当我将Resteasy升级到 3.5.0.Final ;

  • 我当地的环境都很好
  • 部署时我得到以下Stacktrace:
  

来自servlet的未捕获异常   java.lang.NoSuchFieldError:SERVER_SENT_EVENTS_TYPE       在org.jboss.resteasy.core.ResourceMethodInvoker.isSseResourceMethod(ResourceMethodInvoker.java:162)       在org.jboss.resteasy.core.ResourceMethodInvoker。(ResourceMethodInvoker.java:147)       在org.jboss.resteasy.core.ResourceMethodRegistry.processMethod(ResourceMethodRegistry.java:345)       在org.jboss.resteasy.core.ResourceMethodRegistry.register(ResourceMethodRegistry.java:272)       在org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:223)       在org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:195)       在org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:181)       在org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:158)       在org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:77)       在org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:496)       在org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:279)       在org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:86)       在org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:119)       在org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)       在org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:643)       在org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:422)       在org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:892)       at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349)       在org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1406)       at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1368)       在org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)       在org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)       在org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)       at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)       在com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:244)       在com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:182)       在com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:97)       在com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:680)       在com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642)       在com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:612)       在com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run(JavaRuntime.java:806)       在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274)       在java.lang.Thread.run(Thread.java:745)

所以它似乎与环境有关。 有任何解决方法吗?

由于

3 个答案:

答案 0 :(得分:2)

我遇到了同样的错误,通过排除pom.xml中的jar来解决了该问题

<dependencies>
          <dependency>
          [...]
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
                </exclusion>
            </exclusions>
  </dependency>
        </dependencies>

答案 1 :(得分:0)

我遇到了同样的问题。

我已经通过从我的pom文件中删除org.jboss.resteasy.jaxrs-api.3.0.12.Final解决了这个问题。

希望能解决你的问题。

答案 2 :(得分:0)

我有同样的问题。 我猜任何依赖都可能导致javax.ws.rs-api的版本错误。我不知道它到底是哪个依赖。但是在添加之后:

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.1</version>
</dependency>

我的pom.xml问题已解决。无需删除任何其他依赖项