gpt4 book ai didi

java - JAX-RS 网络服务启动时出错

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:44:22 24 4
gpt4 key购买 nike

我重构了一个有效的 JAX-RS、Jersey 实现、web 服务,以便隔离它的实体,以便它们可以用作库,我还更改了项目和包名称,现在当我尝试为了启动 tomcat,我得到了这个 java.lang.NoSuchMethodError error:

 org.glassfish.jersey.model.internal.RankedProvider.getContractTypes()Ljava/util/Set;
at org.glassfish.jersey.server.ApplicationHandler.filterNameBound(ApplicationHandler.java:801)
at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:702)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:484)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:166)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:327)

我用谷歌搜索但找不到与此特定错误相关的任何信息

那些是实体项目的依赖:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.logtec</groupId>
<artifactId>zaprango-entity</artifactId>
<version>1.0</version>

<profiles>
<profile>
<id>default</id>

<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<qbeasy.version>1.1</qbeasy.version>
<maven-compiler.version>1.8</maven-compiler.version>
<uk.co.jemos.podam.podam.version>4.7.3.RELEASE</uk.co.jemos.podam.podam.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${maven-compiler.version}</source>
<target>${maven-compiler.version}</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<!-- QBEasy -->
<dependency>
<groupId>br.com.boilerplatecorp</groupId>
<artifactId>qbeasy</artifactId>
<version>${qbeasy.version}</version>
</dependency>

<!-- PoDam -->
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
<version>${uk.co.jemos.podam.podam.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

<profile>
<id>tomcat</id>

<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<jersey-servlet.version>2.16</jersey-servlet.version>
<org.hibernate.version>4.3.6.Final</org.hibernate.version>
<jackson.version>2.16</jackson.version>
</properties>

<dependencies>
<!-- JPA/Hibernate Impl -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${org.hibernate.version}</version>
</dependency>

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

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.5.1</version>
</dependency>

<!-- JAX-RS/Jersey Impl -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey-servlet.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>

那些是 ws 依赖项:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>logtec</groupId>
<artifactId>zaprango-ws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<profiles>
<profile>
<id>default</id>

<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<!-- Propriedades do projeto -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.fork>true</maven.compiler.fork>

<!-- Dependencias -->
<jee.version>7.0</jee.version>
<qbeasy.version>1.1</qbeasy.version>
<modelmapper.version>0.7.3</modelmapper.version>
<maven-compiler.version>1.8</maven-compiler.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${maven-compiler.version}</source>
<target>${maven-compiler.version}</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>br.com.logtec</groupId>
<artifactId>zaprango-entity</artifactId>
<version>1.0</version>
</dependency>

<!-- JEE 7 API -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${jee.version}</version>
</dependency>

<!-- Model Mapper -->
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>${modelmapper.version}</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
</dependencies>

</profile>

<profile>
<id>tomcat</id>

<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<org.postgresql.jdbc.version>9.3-1102-jdbc4</org.postgresql.jdbc.version>
<weld.version>2.2.4.Final</weld.version>
<jersey-cdi.version>2.14</jersey-cdi.version>
<org.hibernate.version>4.3.6.Final</org.hibernate.version>
<org.hibernate-validator.version>5.1.1.Final</org.hibernate-validator.version>
<c3p0.version>4.3.8.Final</c3p0.version>
<deltaspike.version>1.2.1</deltaspike.version>
<jackson.version>2.16</jackson.version>
</properties>

<dependencies>
<!-- CDI/ Weld Impl -->
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>${weld.version}</version>
</dependency>

<!-- Possibilitando o uso de de CDI com o Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers.glassfish</groupId>
<artifactId>jersey-gf-cdi</artifactId>
<version>${jersey-cdi.version}</version>
</dependency>

<!-- JDBC Driver -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${org.postgresql.jdbc.version}</version>
</dependency>

<!-- Bean Validation/Hibernate Impl -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${org.hibernate-validator.version}</version>
</dependency>

<!-- c3p0 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
</dependencies>
</profile>

<profile>
<id>test</id>

<activation>
<activeByDefault>true</activeByDefault>
</activation>

<properties>
<junit.junit.version>4.12</junit.junit.version>
<uk.co.jemos.podam.podam.version>4.7.3.RELEASE</uk.co.jemos.podam.podam.version>
<arquillian-bom.version>1.1.7.Final</arquillian-bom.version>
<surefire.version>2.17</surefire.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian-bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>2.0.0-alpha-5</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
</plugin>
</plugins>
</build>

<dependencies>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.junit.version}</version>
<scope>test</scope>
</dependency>

<!-- Integracao JUnit e Arquillian -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId>
<scope>test</scope>
</dependency>

<!-- PoDam -->
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
<version>${uk.co.jemos.podam.podam.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>

最佳答案

根据我的经验,当您使用不兼容版本的库时,通常会发生此错误。检查您使用的所有 Jersey 库是否兼容,并且类路径中没有其他版本的 jar。我发现你提到的那个类在'jax-rs-ri'依赖项中,它可能是检查的良好开端。祝你好运!

关于java - JAX-RS 网络服务启动时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29378218/

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