Hi kl,

The problem occurs at [1] which is a OData REST library originally implemented 
using Jersey. Right now we are adapting the project to support CXF 
alternatively. At [2] I have created an example test suite to isolate 
compatibility issues and this can be used to reproduce the problem.

@Sergey: If I run CXF first, then the suite is working and don't throws errors.

Maybe I change the test strategy to run CXF and Jersey isolated from each 
other. Actually this is not a real scenario and it was just convenient to run 
both together.

Regards,
Stephan

[1] http://code.google.com/p/odata4j/
[2] https://bitbucket.org/sklevenz/example/overview



From: K Fung [mailto:[email protected]]
Sent: Sonntag, 29. Januar 2012 01:50
To: [email protected]
Cc: Klevenz, Stephan
Subject: Re: Jersey / CXF compatibility

Hi Stephan,

This just pure speculation on my part but I don't think the 
jsr311-api-<version>.jar supports more than 1 JAX-RS runtime in the same 
process. Inside jsr311, there is some logic that instantiates objects that 
implement the JAX-RS interfaces. The WebApplicationException you're seeing may 
be due to a JAX-RS object from Jersey's namespace being passed to CXF (which 
would like be incompatible). If this is indeed he issue, you may be able get 
around this by separating CXF and Jersey so that they're in their own OSGI 
bundles (each with its own copy of JSR311). However, you'll likely want to 
confirm this is the cause first before going down this avenue.

Do you have a Maven project that illustrates this problem? Also what version of 
CXF are you using?

Regards,
kl

On Sat, Jan 28, 2012 at 5:33 AM, Klevenz, Stephan 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

I'm having a strange problem while executing a compatibility tests suite for 
Jersey and CXF. All tests running twice as parameterized unit tests where the 
first run uses Jersey and the second run is with CXF. Unfortunately CXF is 
throwing an WebApplicationException as you can see from the trace below. If I 
disable the Jersey run then CXF does not show errors. It seems that CXF 
struggle with side effects caused by Jersey. Question is how can this be 
evaluated. The trace is the only hint that I have.

Thanks in advance.

Regards,
Stephan




2012-01-28 14<tel:2012-01-28%2014>:21:17,743 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: 
******************************************************************
2012-01-28 14<tel:2012-01-28%2014>:21:17,743 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: Activated Server Type = 
CXF
2012-01-28 14<tel:2012-01-28%2014>:21:17,743 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: 
******************************************************************
2012-01-28 14<tel:2012-01-28%2014>:21:17,743 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: 
---------------------------------------------------------------
2012-01-28 14<tel:2012-01-28%2014>:21:17,743 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: test class:         
org.example.test.compatibility.SimpleCompatibilityTest
2012-01-28 14<tel:2012-01-28%2014>:21:17,744 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: test method:        
testSimple
2012-01-28 14<tel:2012-01-28%2014>:21:17,744 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: 
---------------------------------------------------------------
2012-01-28 14<tel:2012-01-28%2014>:21:17,764 INFO  [main] 
org.apache.cxf.endpoint.ServerImpl: Setting the server's publish address to be /
2012-01-28 14<tel:2012-01-28%2014>:21:17,765 INFO  [main] 
org.apache.cxf.jaxrs.provider.ProviderFactory: Problem with setting the default 
provider 
org.apache.cxf.jaxrs.provider.JSONProviderorg/codehaus/jettison/mapped/TypeConverter
2012-01-28 14<tel:2012-01-28%2014>:21:17,766 DEBUG [main] 
org.apache.cxf.endpoint.ServerImpl: Server is starting.
2012-01-28 14<tel:2012-01-28%2014>:21:17,766 DEBUG [main] 
org.apache.cxf.transport.servlet.ServletDestination: registering incoming 
observer: 
org.apache.cxf.transport.ChainInitiationObserver@3c095f75<mailto:org.apache.cxf.transport.ChainInitiationObserver@3c095f75>
2012-01-28 14<tel:2012-01-28%2014>:21:17,766 DEBUG [main] 
org.apache.cxf.endpoint.ServerImpl: register the server to serverRegistry
2012-01-28 14<tel:2012-01-28%2014>:21:17,775 INFO  [main] 
org.example.test.compatibility.SimpleCompatibilityTest: uri: 
http://localhost:8810/test/test.svc/root/simple
2012-01-28<http://localhost:8810/test/test.svc/root/simple%0d%0a2012-01-28> 
14:21:17,775 DEBUG [main] 
org.example.test.compatibility.jersey.JerseyTestClient: getResource(), uri = 
http://localhost:8810/test/test.svc/root/simple
2012-01-28<http://localhost:8810/test/test.svc/root/simple%0d%0a2012-01-28> 
14:21:17,952 DEBUG [qtp1692156427-42] 
org.apache.cxf.transport.servlet.ServletController: Service http request on 
thread: Thread[qtp1692156427-42,5,main]
2012-01-28 14<tel:2012-01-28%2014>:21:17,952 DEBUG [qtp1692156427-42] 
org.apache.cxf.transport.http.AbstractHTTPDestination: Create a new message for 
processing
2012-01-28 14<tel:2012-01-28%2014>:21:17,959 DEBUG [qtp1692156427-42] 
org.apache.cxf.transport.http.Headers: Request Headers: {Accept=[text/html, 
image/gif, image/jpeg, *; q=.2, */*; q=.2], Cache-Control=[no-cache], 
connection=[keep-alive], Content-Type=[null], Host=[localhost:8810], 
Pragma=[no-cache], User-Agent=[Java/1.6.0_29]}
2012-01-28 14<tel:2012-01-28%2014>:21:17,976 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Adding interceptor 
org.apache.cxf.interceptor.ServiceInvokerInterceptor@7bc2f501<mailto:org.apache.cxf.interceptor.ServiceInvokerInterceptor@7bc2f501>
 to phase invoke
2012-01-28 14<tel:2012-01-28%2014>:21:17,976 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Adding interceptor 
org.apache.cxf.interceptor.OutgoingChainInterceptor@1d286180<mailto:org.apache.cxf.interceptor.OutgoingChainInterceptor@1d286180>
 to phase post-invoke
2012-01-28 14<tel:2012-01-28%2014>:21:17,976 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Adding interceptor 
org.apache.cxf.interceptor.OneWayProcessorInterceptor@46192974<tel:46192974<mailto:org.apache.cxf.interceptor.OneWayProcessorInterceptor@46192974%3ctel:46192974>>
 to phase pre-logical
2012-01-28 14<tel:2012-01-28%2014>:21:17,976 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Adding interceptor 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1df0a2a0<mailto:org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1df0a2a0>
 to phase unmarshal
2012-01-28 14<tel:2012-01-28%2014>:21:17,977 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Adding interceptor 
org.apache.cxf.transport.https.CertConstraintsInterceptor@653cca0e<mailto:org.apache.cxf.transport.https.CertConstraintsInterceptor@653cca0e>
 to phase pre-stream
2012-01-28 14<tel:2012-01-28%2014>:21:17,977 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Chain 
org.apache.cxf.phase.PhaseInterceptorChain@24c98b07<mailto:org.apache.cxf.phase.PhaseInterceptorChain@24c98b07>
 was created. Current flow:
 pre-stream [CertConstraintsInterceptor]
 unmarshal [JAXRSInInterceptor]
 pre-logical [OneWayProcessorInterceptor]
 invoke [ServiceInvokerInterceptor]
 post-invoke [OutgoingChainInterceptor]

2012-01-28 14<tel:2012-01-28%2014>:21:17,977 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleMessage on 
interceptor 
org.apache.cxf.transport.https.CertConstraintsInterceptor@653cca0e<mailto:org.apache.cxf.transport.https.CertConstraintsInterceptor@653cca0e>
2012-01-28 14<tel:2012-01-28%2014>:21:17,978 DEBUG [qtp1692156427-42] 
org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleMessage on 
interceptor 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1df0a2a0<mailto:org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1df0a2a0>
2012-01-28 14<tel:2012-01-28%2014>:21:17,983 WARN  [qtp1692156427-42] 
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper: 
WebApplicationException has been caught : no cause is available
2012-01-28 14<tel:2012-01-28%2014>:21:17,984 DEBUG [qtp1692156427-42] 
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper: no cause is available
javax.ws.rs.WebApplicationException
at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:139)
at 
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:89)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at 
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
at 
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:127)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:480)
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:941)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at 
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
at 
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
at 
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
at 
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
at 
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
at java.lang.Thread.run(Thread.java:680)
2

Reply via email to