gpt4 book ai didi

jersey - java.lang.AbstractMethodError : javax. ws.rs.core.UriBuilder.uri

转载 作者:行者123 更新时间:2023-12-02 19:09:03 25 4
gpt4 key购买 nike

我尝试启动应用程序,但使用 Tomcat 7 并且遇到这样的异常。

我认为这可能与 Maven 依赖项有关,但我确定。如果有人知道发生了什么事,请回答:)

异常(exception):

message Servlet execution threw an exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:651)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.50 logs.

Maven POM:

<properties>
<application.version>1.0</application.version>
<spring.version>4.0.0.RELEASE</spring.version>
<spring.security.version>3.2.0.RELEASE</spring.security.version>
<jersey.version>1.18.1</jersey.version>
</properties>



<dependencies>
<dependency>
<groupId>climbing-portal-facade</groupId>
<artifactId>climbing-portal-facade</artifactId>
<version>${application.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jdk-http</artifactId>
<version>2.7</version>
</dependency>

<!-- Jersey + Spring -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>${jersey.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>

有什么想法吗?

最佳答案

您正在使用 Jersey 1 & 2 (Jersey 1 是显式依赖项,Jersey 2 是 jersey-test-framework-provider-jdk-http 的传递依赖项),这是不可能的 - 所以 classloader接错了URIBuilder类(class)。

Jersey group 中的依赖项com.sun.jersey都是Jersey version 1Jersey version 2使用组 org.glassfish.jersey

您的 Maven 中都有这两个内容导致此问题的依赖关系。

如果可能,仅使用 Jersey 2

关于jersey - java.lang.AbstractMethodError : javax. ws.rs.core.UriBuilder.uri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23277429/

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