gpt4 book ai didi

java.lang.AbstractMethodError : javax. ws.rs.core.Response$ResponseBuilder.status 错误

转载 作者:行者123 更新时间:2023-11-29 02:58:17 31 4
gpt4 key购买 nike

以前有人见过类似的错误吗?我查看了 maven 依赖项,看起来我正在使用 jersey 2.26。所以,我不认为这是依赖冲突问题。 ResponseBuilder 无法识别方法状态。

从其他帖子了解到,可能与 Jersey 冲突有关。

java.lang.AbstractMethodError: javax.ws.rs.core.Response$ResponseBuilder.status(ILjava/lang/String;)Ljavax/ws/rs/core/Response$ResponseBuilder;
at javax.ws.rs.core.Response$ResponseBuilder.status(Response.java:921)
at javax.ws.rs.core.Response.status(Response.java:592)
at javax.ws.rs.core.Response.status(Response.java:603)
at javax.ws.rs.core.Response.ok(Response.java:638)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:248)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)

<jersey.version>2.26</jersey.version>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-proxy-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring4</artifactId>
<version>${jersey.version}</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>

最佳答案

我在网上尝试了不同的答案和解决方案,但唯一有帮助的是使用这个 mvn 依赖冲突命令

mvn dependency:tree -Dverbose -Dincludes=<conflicted groupId here>

我用 glassfish 和 jersey 运行了几个命令,最后我需要从 org.glassfish.jersey.media jar 中删除以下内容。

 <dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
</exclusion>
</exclusions>
</dependency>

关于java.lang.AbstractMethodError : javax. ws.rs.core.Response$ResponseBuilder.status 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59350068/

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