Getting root cause java.lang.AbstractMethodError while using Jersey ContainerRequestFilter

前端 未结 3 893
抹茶落季
抹茶落季 2021-01-14 16:28
INFO: Server startup in 6705 ms
Nov 29, 2013 6:17:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [JerseyServlet] in         


        
相关标签:
3条回答
  • 2021-01-14 16:38

    you have a maven dependency issue, delete all your dependencies in particular the conteiner jersey dependency and add this ones:

    <dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.9</version>
    </dependency>
    <dependency>
    <groupId>com.sun.jersey.contribs</groupId>
    <artifactId>jersey-multipart</artifactId>
    <version>1.9</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-json-provider</artifactId>
    <version>2.5.1</version>
    </dependency>
    
    0 讨论(0)
  • 2021-01-14 16:38

    I needed a more specific answer to the problem so I added the following plugin to maven:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-enforcer-plugin</artifactId>
      <version>3.0.0-M3</version>
      <executions>
        <execution>
          <id>enforce</id>
          <configuration>
            <rules>
              <dependencyConvergence/>
            </rules>
          </configuration>
          <goals>
            <goal>enforce</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    

    The above showed me all the dependency conflicts so I managed to resolved more than the aforementioned problem and keep my dependency tree tidy.

    The plugin runs when calling:

    mvn clean install
    

    And shows you a warning as follows:

    [WARNING] 
    Dependency convergence error for com.fasterxml.jackson.core:jackson-core:2.8.10 paths to dependency are:
    +-com.omilia:partners:5.4.0-RC-3
      +-org.glassfish.jersey.media:jersey-media-json-jackson:2.27
        +-com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.8.10
          +-com.fasterxml.jackson.core:jackson-core:2.8.10
    and
    +-com.omilia:partners:5.4.0-RC-3
      +-com.fasterxml.jackson.core:jackson-databind:2.9.6
        +-com.fasterxml.jackson.core:jackson-core:2.9.6
    

    Subsequently, you can exclude the specific package, when referencing your dependency in your pom:

    <exclusion>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </exclusion>
    

    More Information can be found here:

    Dependency Convergence Maven Documentation

    0 讨论(0)
  • 2021-01-14 16:45

    It seems that you're using Jersey 1.x (JAX-RS 1.1 implementation) with JAX-RS 2.0 APIs. In your application either switch to Jersey 2 (recommended) or replace JAX-RS 2.0 API jar with JAX-RS 1.1 API jar (it's already part of the jersey-common so removing 2.0 API should be sufficient).

    0 讨论(0)
提交回复
热议问题