com.sun.ws.rs.ext.RuntimeDelegateImpl error

我是研究僧i 提交于 2019-12-20 18:34:49

问题


please help currently I'm building a system that allowing the restful (jersey 1.12) to be invoked by some webservices (Axis2) the scenario is like this:

client --> webservice (Axis2) --> restful services (Jersey 1.12) ... run in the tomcat Apache 7 there's some problem occurs whenever I try to invoke the jersey. says that

java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl

here the complete error in 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 

I guess it's caused by missing some jars either in apache lib or in my axisservice lib actually i put all the jersey jars into the axisservice lib,,, I have test the axis2 --> restful with the webservice test explorer in eclipse, it works just fine but whenever i try it from a client (as i showed in the scenario above) it doesnt work.

Please advice, thanks in advance


回答1:


The com.sun.ws.rs.ext package, and therefore RuntimeDelegateImpl, is contained in the jersey client jar. If you're using maven then add this dependency to your pom.xml (here I'm using jersey client v1.12):

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-client</artifactId>
    <version>1.12</version>
</dependency>



回答2:


Please add the following dependencies in your maven project which provides the implementation of the RuntimeDelegate

<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle-jaxrs</artifactId>
        <version>2.7.18</version>
</dependency>


来源:https://stackoverflow.com/questions/9666584/com-sun-ws-rs-ext-runtimedelegateimpl-error

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