Jersey 2 Client java.lang.NoSuchMethodError: org.glassfish.jersey.CommonProperties.getValue

余生长醉 提交于 2019-12-10 11:02:17

问题


I'm trying to setup a very simple Jersey client example. So I started with a pom.xml like this:

<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>com.example</groupId>
    <artifactId>simple-service-webapp</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>simple-service-webapp</name>

    <build>
        <finalName>simple-service-webapp</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>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
        </dependency>

    </dependencies>
    <properties>
        <jersey.version>2.23</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

And code like this:

Client client = ClientBuilder.newClient();
WebTarget webTarget = client.target("http://api.openweathermap.org/data/2.5/weather?q=berlin");
Invocation.Builder request = webTarget.request(MediaType.APPLICATION_JSON);
Response response = request.get();
System.out.println(response.getStatus());
String x = response.readEntity(String.class);
System.out.println(x);

Which resulted in the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Predicate
at org.glassfish.jersey.client.ClientConfig$State.<init>(ClientConfig.java:144)
at org.glassfish.jersey.client.ClientConfig.<init>(ClientConfig.java:423)
at org.glassfish.jersey.client.JerseyClientBuilder.<init>(JerseyClientBuilder.java:72)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:116)
at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206)
at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86)
at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
at client.ApiService.main(ApiService.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Predicate
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 18 more

So I tried to fix this by adding the following to my pom.xml:

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>19.0</version>
</dependency>

But then I get this error message and cannot really understand why:

Exception in thread "main" java.lang.NoSuchMethodError: org.glassfish.jersey.CommonProperties.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:69)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:617)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:558)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:363)
at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:85)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:117)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:114)
at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:311)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:669)
at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:213)
at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:124)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:97)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:90)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:387)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:291)

mvn org.apache.maven.plugins:maven-dependency-plugin:2.9:resolve-plugins gives me this:

    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Djava.util.Arrays.useLegacyMergeSort=true -Dstringchararrayaccessor.disabled=true
[INFO] Scanning for projects...
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/plugins/maven-dependency-plugin/2.9/maven-dependency-plugin-2.9.pom
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/plugins/maven-dependency-plugin/2.9/maven-dependency-plugin-2.9.pom (13 KB at 54.7 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/plugins/maven-dependency-plugin/2.9/maven-dependency-plugin-2.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/plugins/maven-dependency-plugin/2.9/maven-dependency-plugin-2.9.jar (154 KB at 1826.2 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-service-webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.9:resolve-plugins (default-cli) @ simple-service-webapp ---
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/reporting/maven-reporting-impl/2.2/maven-reporting-impl-2.2.pom
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/reporting/maven-reporting-impl/2.2/maven-reporting-impl-2.2.pom (5 KB at 75.7 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.pom
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.pom (4 KB at 53.9 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.10/plexus-io-2.0.10.pom
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.10/plexus-io-2.0.10.pom (3 KB at 44.1 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.9/plexus-io-2.0.9.pom
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.9/plexus-io-2.0.9.pom (3 KB at 46.0 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-analyzer/1.5/maven-dependency-analyzer-1.5.pom
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-analyzer/1.5/maven-dependency-analyzer-1.5.pom (6 KB at 89.2 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom (5 KB at 92.3 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/ow2/asm/asm/5.0.2/asm-5.0.2.pom
Downloaded: https://repo.xy.de/repoproxy/org/ow2/asm/asm/5.0.2/asm-5.0.2.pom (2 KB at 19.1 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/ow2/asm/asm-parent/5.0.2/asm-parent-5.0.2.pom
Downloaded: https://repo.xy.de/repoproxy/org/ow2/asm/asm-parent/5.0.2/asm-parent-5.0.2.pom (6 KB at 71.5 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.pom
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.pom (8 KB at 104.3 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/reporting/maven-reporting-impl/2.2/maven-reporting-impl-2.2.jar
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.jar
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.9/plexus-io-2.0.9.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-analyzer/1.5/maven-dependency-analyzer-1.5.jar
Downloading: https://repo.xy.de/repoproxy/org/ow2/asm/asm/5.0.2/asm-5.0.2.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-analyzer/1.5/maven-dependency-analyzer-1.5.jar (31 KB at 471.6 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/reporting/maven-reporting-impl/2.2/maven-reporting-impl-2.2.jar (17 KB at 228.7 KB/sec)
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-io/2.0.9/plexus-io-2.0.9.jar (58 KB at 797.9 KB/sec)
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.jar (161 KB at 1929.1 KB/sec)
Downloaded: https://repo.xy.de/repoproxy/org/ow2/asm/asm/5.0.2/asm-5.0.2.jar (52 KB at 597.5 KB/sec)
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar (63 KB at 535.1 KB/sec)
[INFO] Plugin Resolved: maven-install-plugin-2.4.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.jar (13 KB at 199.3 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar (114 KB at 1745.5 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar (85 KB at 1222.7 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar (56 KB at 849.0 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar (86 KB at 1254.6 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-model-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-manager-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.6.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.5.jar
[INFO]     Plugin Dependency Resolved: plexus-digest-1.0.jar
[INFO] Plugin Resolved: maven-deploy-plugin-2.7.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-model-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.6.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-1.5.6.jar
[INFO] Plugin Resolved: maven-war-plugin-2.2.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.jar (149 KB at 2145.8 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar (48 KB at 726.5 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-monitor/2.0.6/maven-monitor-2.0.6.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-monitor/2.0.6/maven-monitor-2.0.6.jar (11 KB at 166.7 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar
Downloaded: https://repo.xy.de/repoproxy/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar (190 KB at 2284.7 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-model-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-core-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-settings-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-monitor-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-archiver-2.5.jar
[INFO]     Plugin Dependency Resolved: plexus-io-2.0.2.jar
[INFO]     Plugin Dependency Resolved: plexus-archiver-2.1.jar
[INFO]     Plugin Dependency Resolved: plexus-interpolation-1.15.jar
[INFO]     Plugin Dependency Resolved: plexus-container-default-1.0-alpha-9-stable-1.jar
[INFO]     Plugin Dependency Resolved: xstream-1.3.1.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-filtering-1.0-beta-2.jar
[INFO] Plugin Resolved: maven-surefire-plugin-2.12.4.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.jar (13 KB at 217.1 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-artifact/2.0.9/maven-artifact-2.0.9.jar (87 KB at 1423.4 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar (119 KB at 1698.9 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/2.0.9/maven-core-2.0.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/2.0.9/maven-core-2.0.9.jar (156 KB at 2435.8 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.jar (38 KB at 628.5 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.9.jar
[INFO]     Plugin Dependency Resolved: surefire-booter-2.12.4.jar
[INFO]     Plugin Dependency Resolved: maven-surefire-common-2.12.4.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.8.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-core-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-toolchain-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-annotations-3.1.jar
[INFO] Plugin Resolved: maven-site-plugin-3.3.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/3.0/maven-core-3.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-core/3.0/maven-core-3.0.jar (515 KB at 7148.4 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-model/3.0/maven-model-3.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-model/3.0/maven-model-3.0.jar (161 KB at 2144.3 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/3.0/maven-plugin-api-3.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-plugin-api/3.0/maven-plugin-api-3.0.jar (48 KB at 702.6 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings/3.0/maven-settings-3.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings/3.0/maven-settings-3.0.jar (46 KB at 843.9 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings-builder/3.0/maven-settings-builder-3.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-settings-builder/3.0/maven-settings-builder-3.0.jar (37 KB at 576.5 KB/sec)
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/wagon/wagon-provider-api/1.0/wagon-provider-api-1.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/wagon/wagon-provider-api/1.0/wagon-provider-api-1.0.jar (52 KB at 787.0 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-reporting-exec-1.1.jar
[INFO]     Plugin Dependency Resolved: maven-core-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-model-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-api-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-settings-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-settings-builder-3.0.jar
[INFO]     Plugin Dependency Resolved: maven-archiver-2.4.2.jar
[INFO]     Plugin Dependency Resolved: doxia-sink-api-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-logging-api-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-core-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-module-xhtml-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-module-apt-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-module-xdoc-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-module-fml-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-module-markdown-1.4.jar
[INFO]     Plugin Dependency Resolved: servlet-api-2.5.jar
[INFO]     Plugin Dependency Resolved: doxia-decoration-model-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-site-renderer-1.4.jar
[INFO]     Plugin Dependency Resolved: doxia-integration-tools-1.5.jar
[INFO]     Plugin Dependency Resolved: wagon-provider-api-1.0.jar
[INFO]     Plugin Dependency Resolved: plexus-archiver-1.0.jar
[INFO]     Plugin Dependency Resolved: plexus-i18n-1.0-beta-7.jar
[INFO]     Plugin Dependency Resolved: velocity-1.5.jar
[INFO]     Plugin Dependency Resolved: plexus-velocity-1.1.8.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-1.5.10.jar
[INFO]     Plugin Dependency Resolved: jetty-6.1.25.jar
[INFO]     Plugin Dependency Resolved: jetty-util-6.1.25.jar
[INFO]     Plugin Dependency Resolved: commons-lang-2.5.jar
[INFO]     Plugin Dependency Resolved: commons-io-1.4.jar
[INFO] Plugin Resolved: maven-clean-plugin-2.5.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.6.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.jar
[INFO] Plugin Resolved: maven-resources-plugin-2.6.jar
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-project-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-core-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-settings-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-model-2.0.6.jar
[INFO]     Plugin Dependency Resolved: maven-monitor-2.0.6.jar
[INFO]     Plugin Dependency Resolved: plexus-container-default-1.0-alpha-9-stable-1.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-2.0.5.jar
[INFO]     Plugin Dependency Resolved: maven-filtering-1.1.jar
[INFO]     Plugin Dependency Resolved: plexus-interpolation-1.13.jar
[INFO] Plugin Resolved: maven-compiler-plugin-2.5.1.jar
Downloading: https://repo.xy.de/repoproxy/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.jar
Downloaded: https://repo.xy.de/repoproxy/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.jar (33 KB at 563.9 KB/sec)
[INFO]     Plugin Dependency Resolved: maven-plugin-api-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-artifact-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-core-2.0.9.jar
[INFO]     Plugin Dependency Resolved: maven-toolchain-1.0.jar
[INFO]     Plugin Dependency Resolved: plexus-utils-3.0.jar
[INFO]     Plugin Dependency Resolved: plexus-compiler-api-1.9.1.jar
[INFO]     Plugin Dependency Resolved: plexus-compiler-manager-1.9.1.jar
[INFO]     Plugin Dependency Resolved: plexus-compiler-javac-1.9.1.jar
[INFO]     Plugin Dependency Resolved: plexus-container-default-1.0-alpha-9-stable-1.jar

回答1:


You did not provide imports for your sample java but it looks like you have different version of org.glassfish.jersey.client.ClientConfig in your classpath - in jersey-client-2.23 (which is a dependency for jersey-server, which is a dependency for jersey-container-servlet-core). Predicate (and any Guava stuff) in Jersey should refer to jersey.repackaged.com.google.common.*, not to com.google.common.* - check where ClientConfig comes from.



来源:https://stackoverflow.com/questions/37540271/jersey-2-client-java-lang-nosuchmethoderror-org-glassfish-jersey-commonproperti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!