gpt4 book ai didi

java - Spring Jersey : java. lang.NoSuchMethodError : org. glassfish.jersey.server.ServerProperties.getValue?

转载 作者:搜寻专家 更新时间:2023-11-01 03:38:11 24 4
gpt4 key购买 nike

我的 web.xml 看起来像

<web-app >
<servlet>
<servlet-name>InventoryApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>InventoryApplication</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
</web-app>

和端点为

@Component
@Path("/hello")
public class HelloResource {

@GET
public void hello() {
System.out.println("REQUEST RECEIVED");

}
}

当我使用 cargo as mvn:cargo:run 部署它时,我看到错误为

[INFO] [talledLocalContainer] May 03, 2014 5:09:59 PM org.apache.catalina.core.StandardWrapperValve invoke
[INFO] [talledLocalContainer] SEVERE: Allocate exception for servlet com.yahoo.pryme_services.inventory.services.InventoryApplication
[INFO] [talledLocalContainer] java.lang.NoSuchMethodError: org.glassfish.jersey.server.ServerProperties.getValue(Ljava/util/Map;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
[INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:315)
[INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:169)
[INFO] [talledLocalContainer] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:359)
[INFO] [talledLocalContainer] at javax.servlet.GenericServlet.init(GenericServlet.java:158)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
[INFO] [talledLocalContainer] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
[INFO] [talledLocalContainer] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
[INFO] [talledLocalContainer] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
[INFO] [talledLocalContainer] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
[INFO] [talledLocalContainer] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
[INFO] [talledLocalContainer] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
[INFO] [talledLocalContainer] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer]

这是怎么回事?

最佳答案

我在切换到最近的 Grizzly 容器版本时遇到了同样的问题, 没有调整 Jersey 版本。

在我的具体案例中,

<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>2.15</version>

有冲突

<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>2.7</version>

带着 Jersey 到 2.15 解决了这个问题。

关于java - Spring Jersey : java. lang.NoSuchMethodError : org. glassfish.jersey.server.ServerProperties.getValue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23451175/

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