请帮助目前我正在build立一个系统,允许restful(jersey1.12)被一些webservices(Axis2)调用情况是这样的:
客户端 – > webservice(Axis2) – > restful服务(Jersey 1.12)…运行在Tomcat Apache 7中有一些问题,每当我尝试调用jersey。 这样说
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
这里完整的错误在Apache中,
[ERROR] java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav a:212) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:117) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines sLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe ssageReceiver.java:110) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq uest(HTTPTransportUtils.java:172) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1 46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica torBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp 11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process( AbstractProtocol.java:579) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin t.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:603) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun .ws.rs.ext.RuntimeDelegateImpl at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:112) at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69) at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80) at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99) at wsPackage.TweetClass.getBaseURI(TweetClass.java:46) at wsPackage.TweetClass.tweet(TweetClass.java:39) ... 29 more Caused by: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateIm pl at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1701) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1546) at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:44) at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:141) at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:95) ... 34 more
我想这是由于缺less一些在Apache的lib或在我的axisservice lib的jar实际上,我把所有的jerseyjar放入axisservice库,,,我已经testing了axis2 – >与eclipse中的Web服务testing资源pipe理器的宁静,它的工作原理蛮好的,但是每当我从客户端尝试它(正如我在上面的场景中所示)它不工作。
请咨询,提前致谢
com.sun.ws.rs.ext包,因此RuntimeDelegateImpl包含在球衣客户端jar中。 如果你使用的是maven,那么把这个依赖关系添加到你的pom.xml(这里我使用的是jersey客户端v1.12):
<dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.12</version> </dependency>
请在提供RuntimeDelegate实现的Maven项目中添加以下依赖项
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-bundle-jaxrs</artifactId> <version>2.7.18</version> </dependency>