You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "metatech (JIRA)" <ji...@apache.org> on 2012/10/29 11:59:12 UTC

[jira] [Commented] (CXF-4232) java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: org/apache/cxf/jaxrs/impl/ResponseImpl

    [ https://issues.apache.org/jira/browse/CXF-4232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13485954#comment-13485954 ] 

metatech commented on CXF-4232:
-------------------------------

Same problem with WebLogic 12c.
The JAX-RS API classes (JSR 311) are present in the server classpath, but the CXF implementation is only included in the WAR file.
The first call to the JAX-RS API method "RuntimeDelegate.getInstance" discovers the CXF implementation (class org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl) in the WAR file, and caches its reference in a static member variable of the RuntimeDelegate class.
When the application is redeployed, the old reference is not valid anymore, which raises the NoClassDefFoundError exception.
On WebLogic, the solution is to add a "prefer-application-packages" block in weblogic.xml, including the package "javax.ws.rs.*"
The JSR 311 JAR included in the WAR takes precedence on the one present in the classpath, which isolates "RuntimeDelegate" instances from each other.

{code}
java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/ResponseBuilderImpl
	at org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl.createResponseBuilder(RuntimeDelegateImpl.java:80)
	at javax.ws.rs.core.Response$ResponseBuilder.newInstance(Response.java:356)
{code}

                
> java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: org/apache/cxf/jaxrs/impl/ResponseImpl
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4232
>                 URL: https://issues.apache.org/jira/browse/CXF-4232
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.1
>         Environment: geronimo-jetty8-minimal-3.0-beta-1\bin
>            Reporter: TONG Yanqun
>             Fix For: 2.4.1
>
>
> The problem was occur not every time. 
> It was disappear after the Geronimo was restarted several times.
> My webapp source code:
> builder = Response.ok("just a test!");
> The error stack:
> 2012-04-08 19:13:55,093 WARN  [log] /favicon.ico
> java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: org/apache/cxf/jaxrs/impl/ResponseImpl
> 	at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:107)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
> 	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
> 	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
> 	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:228)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:956)
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:411)
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:188)
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:891)
> 	at org.apache.geronimo.jetty8.handler.GeronimoWebAppContext.doScope(GeronimoWebAppContext.java:240)
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
> 	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
> 	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
> 	at org.eclipse.jetty.server.Server.handle(Server.java:353)
> 	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:598)
> 	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1059)
> 	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590)
> 	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
> 	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:427)
> 	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
> 	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
> 	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
> 	at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:243)
> 	at org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:373)
> 	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: org.apache.cxf.interceptor.Fault: org/apache/cxf/jaxrs/impl/ResponseImpl
> 	at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
> 	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:164)
> 	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:91)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> 	at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> 	... 35 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/ResponseImpl
> 	at org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl.createResponseBuilder(RuntimeDelegateImpl.java:80)
> 	at javax.ws.rs.core.Response$ResponseBuilder.newInstance(Response.java:65)
> 	at javax.ws.rs.core.Response.status(Response.java:270)
> 	at javax.ws.rs.core.Response.ok(Response.java:233)
> 	at com.cxf.rest.MyWebService.getFavicon(MyWebService.java:55)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:601)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
> 	... 44 more
> Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxrs.impl.ResponseImpl
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
> 	at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> 	... 55 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira