NoSuchMethodError javax.ws.rs.core.- Anwendung.getProperties()Ljava/util/Karte

Ich versuche, meine erste REST-Anwendung.

Unten ist meine Konfiguration:

  • Java 7
  • JBoss AS 7.1
  • Jersey 2.22.2

Unten sind die Liste der Gläser, heruntergeladen von Maven:

NoSuchMethodError javax.ws.rs.core.- Anwendung.getProperties()Ljava/util/Karte

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.prasad</groupId>
<artifactId>messenger</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>messenger</name>

<build>
    <finalName>messenger</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

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

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
        <!-- artifactId>jersey-container-servlet</artifactId -->
        <exclusions>
</exclusions>
    </dependency>
    <!-- uncomment this to get JSON support
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
    </dependency>
    -->
</dependencies>
<properties>
    <jersey.version>2.22.2</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Auf dem server starten, ich erhalte die unten Ausnahme:

21:14:29,013 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/messenger]] (MSC service thread 1-1) StandardWrapper.Throwable: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:331) [jersey-server-2.22.2.jar:]
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392) [jersey-container-servlet-core-2.22.2.jar:]
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177) [jersey-container-servlet-core-2.22.2.jar:]
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369) [jersey-container-servlet-core-2.22.2.jar:]
    at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]

Laut den Protokollen über ApplicationHandler.init() Methode ruft Application.getProperties().

ApplicationHandler ist in jersey-server-2.22.2.jar und Application ist in javax.ws.rs-api-2.0.1, beide Gläser sind vorhanden in den build-Pfad.

Aber ich bin noch immer NoSuchMethodError. Ich habe unten links:

  • link 1 Ich bin nicht mit swagger an alle;
  • link 2 Ich konnte nicht sehen, mehr als eine version von Application Klasse;
  • link 3 Ich bin mit JRE 7 und JBoss AS 7.1 ist auch JDK 7 kompatibel.

Also ich habe nur eine Anwendung enthält getProperties() Methode und selbst dann bin ich immer NoSuchMethodError. Kann einer bitte mir Grund geben, warum dies passiert ist?

InformationsquelleAutor prasad | 2016-04-23
Schreibe einen Kommentar