gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-11-01 02:36:25 26 4
gpt4 key购买 nike

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

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

  • 在我的本地环境中一切正常
  • 我在部署时得到以下 Stacktrace:

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

所以这似乎与环境有关。有什么线索可以解决吗?

谢谢

最佳答案

我发布了我在 Github 中收到的@NicoNes 的回答

Hi @freddyboucher I don't think that this commit is responsible of the NoSuchFieldError you are dealing with. Resteasy 3.1.4.Final is an implementation of the JAX-RS-API 2.0.1 spec whereas 3.5.1.Final is an impl of the JAX-RS-API 2.1 spec. And the missing field you are talking about is coming from the javax.ws.rs.core.MediaType in JAX-RS-API 2.1. So can you please be sure that your runtime execution does not embed the wrong version o the JAX-RS-API ?

Let me know.

-Nicolas

他是对的,我的 pom.xml 中有:

  <dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</dependencyManagement>

升级到 2.1,解决了我的问题!

关于java - Resteasy 3.5.0.Final on App Engine 标准环境 - NoSuchFieldError SERVER_SENT_EVENTS_TYPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49871007/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com