Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-4241

SwitchYard Resteasy component must use JAX-RS 1.1 in Fuse on Karaf

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Blocker Blocker
    • jboss-fuse-6.2.1
    • jboss-fuse-6.2.1
    • SwitchYard
    • None

      There are two versions of javax.ws.rs package exported: exports | grep javax.ws.rs:

      • 2.0.0 by Apache ServiceMix :: Specs :: JSR-339 API 2.0 (2.5.0)
      • 1.1.1 by jsr311-api (1.1.1)

      When switchyard-rest feature installed, the switchyard-component-resteasy imports the version 2.0.0 provided by Apache ServiceMix. BUT, the switchyard-component-resteasy uses resteasy-jaxrs_2.3.10.Final, and this version of RestEasy does not support JAX-RS 2.0, only the prev version.

      The are cooperating two incompatible version of JAX-RS. It leads to java.lang.AbstractMethodError when JAX-RS 2.0 classes tries to call methods on JAX-RS 1.0 classes form RestEasy.

      You can see the error when you crate own implementation of RESTEasyMessageComposer and in the decompose method throws WebApplicationException:

      public class AuthenticatedServiceRestComposer extends RESTEasyMessageComposer {
      
      	@Override
      	public RESTEasyBindingData decompose(Exchange exchange, RESTEasyBindingData target) throws Exception {
      		throw new WebApplicationException(
      				Response.status(Response.Status.UNAUTHORIZED)
      						.entity(he.toString())
      						.type(MediaType.TEXT_PLAIN)
      						.build()
      		);
      	}
      }
      

      The WebApplicationException is then from JAX-RS 2.0.0, Response is ServerResponse created by RESTEasy, so it is from JAX-RS 1.1.1.

      The resulting exception:

      org.jboss.resteasy.spi.UnhandledException: java.lang.AbstractMethodError: javax.ws.rs.core.Response.getStatusInfo()Ljavax/ws/rs/core/Response$StatusType;
      	at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:364)
      	at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:232)
      	at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:208)
      	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:556)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:523)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
      	at org.switchyard.component.resteasy.osgi.OsgiRESTEasyServletWrapper.service(OsgiRESTEasyServletWrapper.java:74)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
      	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
      	at org.eclipse.jetty.server.Server.handle(Server.java:370)
      	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
      	at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
      	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
      	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.AbstractMethodError: javax.ws.rs.core.Response.getStatusInfo()Ljavax/ws/rs/core/Response$StatusType;
      	at javax.ws.rs.WebApplicationException.computeExceptionMessage(WebApplicationException.java:205)
      	at javax.ws.rs.WebApplicationException.<init>(WebApplicationException.java:179)
      	at javax.ws.rs.WebApplicationException.<init>(WebApplicationException.java:88)
      	at org.jboss.soa.qa.securitypolicy.composers.AuthenticatedServiceRestComposer.decompose(AuthenticatedServiceRestComposer.java:18)
      	at org.switchyard.component.resteasy.composer.RESTEasyMessageComposer.decompose(RESTEasyMessageComposer.java:30)
      	at org.switchyard.component.resteasy.InboundHandler.invoke(InboundHandler.java:146)
      	at org.switchyard.component.resteasy.util.RESTEasyProxy.invoke(RESTEasyProxy.java:120)
      	at com.sun.proxy.$Proxy111.processAuthenticated(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:168)
      	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
      	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
      	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
      	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:541)
      

          There are no Sub-Tasks for this issue.

              tcunning@redhat.com Thomas Cunningham
              vchalupa_jira Václav Chalupa (Inactive)
              Josef Ludvicek Josef Ludvicek (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: