简体   繁体   English

Servlet执行引发异常-java.lang.NoSuchMethodError:org.glassfish.jersey.client.ClientProperties.getValue

[英]Servlet execution threw an exception - java.lang.NoSuchMethodError: org.glassfish.jersey.client.ClientProperties.getValue

I have a maven web application with the following project facets enabled. 我有一个启用以下项目构面的Maven Web应用程序。

  • Dynamic Web Project 3.0 动态Web项目3.0
  • JAX-RS REst Web Services 2.0 JAX-RS REst Web服务2.0
  • Java 1.7 Java 1.7

What I am basically trying to do is expose one of our functionalities as a RESTful web service, for which, I am using Jersey packages. 我基本上想做的是将我们的功能之一作为RESTful Web服务公开,为此,我正在使用Jersey软件包。

When I hit the rest URL, I am getting the following exception. 当我点击其余网址时,出现以下异常。

    SEVERE: Servlet.service() for servlet [com.bnym.dwf.BulkRemoveCSVEntitlements] in context with path [/bnym-dwf-rest-app] threw exception [Servlet execution threw an exception] with root cause
    java.lang.NoSuchMethodError: org.glassfish.jersey.client.ClientProperties.getValue(Ljava/util/Map;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
    at org.glassfish.jersey.client.authentication.HttpAuthenticationFilter.getMaximumCacheLimit(HttpAuthenticationFilter.java:166)
    at org.glassfish.jersey.client.authentication.HttpAuthenticationFilter.<init>(HttpAuthenticationFilter.java:130)
    at org.glassfish.jersey.client.authentication.HttpAuthenticationFeature.configure(HttpAuthenticationFeature.java:602)
    at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:609)
    at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:550)
    at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:361)
    at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:84)
    at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:116)
    at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:113)
    at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:275)
    at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:667)
    at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:162)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:644)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:375)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:275)
    at com.activiti.extension.bean.ActivitiEntitlementsMain.getUsers(ActivitiEntitlementsMain.java:114)
    at com.activiti.extension.bean.RemoveCEEPEntitlements.bulkRemoval(RemoveCEEPEntitlements.java:47)
    at com.activiti.extension.bean.DWFCommon.bulkRemoveUsingCSV(DWFCommon.java:640)
    at com.bnym.dwf.BulkRemoveCSVEntitlements.service(BulkRemoveCSVEntitlements.java:54)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I guess this is an issue with the version of Jersey that I am using. 我猜这是我使用的Jersey版本的问题。 The list of dependencies snippet from my pom.xml is as follows. 我的pom.xml中的依赖项代码片段列表如下。

<dependencies>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2.external</groupId>
        <artifactId>aopalliance-repackaged</artifactId>
        <version>2.4.0-b31</version>
    </dependency>

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-util</artifactId>
        <version>3.3.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-api</artifactId>
        <version>1.2.13</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-impl</artifactId>
        <version>1.2.13</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-local</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>commons-discovery</groupId>
        <artifactId>commons-discovery</artifactId>
        <version>0.2</version>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>ewh.E3</groupId>
        <artifactId>E3Client</artifactId>
        <version>0.0.1.2-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.owlike</groupId>
        <artifactId>genson</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2</groupId>
        <artifactId>hk2-api</artifactId>
        <version>2.4.0-b25</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2</groupId>
        <artifactId>hk2-locator</artifactId>
        <version>2.4.0-b25</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2</groupId>
        <artifactId>hk2-utils</artifactId>
        <version>2.4.0-b25</version>
    </dependency>
    <dependency>
        <groupId>httpcomponents-httpcore</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.0-alpha6</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.18.1-GA</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2.external</groupId>
        <artifactId>javax.inject</artifactId>
        <version>2.4.0-b25</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.6</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-common</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.bundles.repackaged</groupId>
        <artifactId>jersey-guava</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-jaxb</artifactId>
        <version>2.19</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson1</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.13</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.neethi</groupId>
        <artifactId>neethi</artifactId>
        <version>3.0.2</version>
    </dependency>
    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>3.3</version>
    </dependency>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>4.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.hk2</groupId>
        <artifactId>osgi-resource-locator</artifactId>
        <version>1.0.1</version>
    </dependency>
    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.1.0.Final</version>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.schema</groupId>
        <artifactId>XmlSchema</artifactId>
        <version>1.4.7</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
    </dependency>
</dependencies>

I was using Jersey 2.19 packages earlier but then changed to 2.13. 我之前使用的是Jersey 2.19软件包,但后来更改为2.13。 I have tried doing maven clean and maven build as well as Eclipse IDE's clean and build project multiple times. 我尝试过多次进行maven clean和maven build以及Eclipse IDE的clean and build项目。

In jersey-client 2.13 documentation, I find the getValue method available under ClientProperties class. 在jersey-client 2.13文档中,我在ClientProperties类下找到了getValue方法。 Can someone help me identify why the issue still occurs? 有人可以帮我确定为什么问题仍然存在吗?

To resolve these kind of errors, I usually, always update the sources of all the dependencies available in the POM. 为了解决这类错误,我通常总是更新POM中所有可用依赖项的来源。

Use the below command to fetch all sources of the jar files: 使用以下命令来获取jar文件的所有源:

mvn dependency:sources

Now go back to eclipse, use the Ctrl + Shift + T, to find the ' org.glassfish.jersey.client.ClientProperties ' file, and verify the getValue() method(s). 现在返回eclipse,使用Ctrl + Shift + T查找org.glassfish.jersey.client.ClientProperties文件,并验证getValue()方法。

If you find the right method (with correct order of parameters), then it is a run time issue. 如果找到正确的方法(具有正确的参数顺序),那么它将是运行时问题。 Check your server lib to find any older(new) versions of that jar. 检查您的服务器lib以找到该jar的所有旧(新)版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Jersey:java.lang.NoSuchMethodError:org.glassfish.jersey.server.ServerProperties.getValue? - Spring Jersey: java.lang.NoSuchMethodError: org.glassfish.jersey.server.ServerProperties.getValue? java.lang.NoSuchMethodError:org.glassfish.jersey.client.ClientRequest.getLengthLong()J - java.lang.NoSuchMethodError: org.glassfish.jersey.client.ClientRequest.getLengthLong()J java.lang.NoSuchMethodError: org.glassfish.hk2.api.ServiceLocatorFactory.creat - Jersey - java.lang.NoSuchMethodError: org.glassfish.hk2.api.ServiceLocatorFactory.creat - Jersey 引起:java.lang.NoSuchMethodError: org.glassfish.jersey.message.internal.HeaderUtils.asStringHeadersSingleValue - Caused by: java.lang.NoSuchMethodError: org.glassfish.jersey.message.internal.HeaderUtils.asStringHeadersSingleValue loadOnStartup 严重:Web 应用程序 [/Producer] 中的 Servlet [dispatcher] 抛出 load() 异常 java.lang.NoSuchMethodError - loadOnStartup SEVERE: Servlet [dispatcher] in web application [/Producer] threw load() exception java.lang.NoSuchMethodError org.glassfish.jersey.server.ContainerException:java.lang.NoSuchMethodError:org.jvnet.mimepull.MIMEMessage.close()V - org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: org.jvnet.mimepull.MIMEMessage.close()V java.lang.NoSuchMethodError: org.json.JSONObject.getNames 异常 - java.lang.NoSuchMethodError: org.json.JSONObject.getNames Exception 问题:java.lang.UnsupportedClassVersionError:org / glassfish / jersey / servlet / ServletContainer - Issue: java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer java.lang.ClassNotFoundException:org.glassfish.jersey.servlet.ServletContainer - java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer 异常java.lang.NoSuchMethodError - Exception java.lang.NoSuchMethodError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM