4 Replies Latest reply on Apr 14, 2011 1:59 PM by osnetwork

    Async RESTeasy on JBAS6

    osnetwork

      Hello everybody,

       

      I think that the async module of RESTeasy is not working on JBAS6. Is there some configuration changes that needs to be done in order to get it working?

       

      I have tried Servlet3AsyncHttpRequest, JBossWebAsyncHttpRequest and JBossWebDispatcherServlet none of those works, while JBossWebDispatcherServlet was working fine on JBAS5.1.

       

      I was wondering if I need to copy any async-http-*.jar libraries somewhere inside the JBAS or if I can leave them packed in the war file.

       

      Thanks in advance,

      Luca

        • 1. Re: Async RESTeasy on JBAS6
          osnetwork

          Here are more details.

           

          On the server I get:

           

           

          21:37:23,509 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test-async]] Marking servlet ResteasyAsync as unavailable

          21:37:23,510 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test-async].[ResteasyAsync]] Allocate exception for servlet ResteasyAsync: java.lang.InstantiationException: org.jboss.resteasy.plugins.server.servlet.JBossWebAsyncHttpRequest

                    at java.lang.Class.newInstance0(Class.java:340) [:1.6.0_24]

                    at java.lang.Class.newInstance(Class.java:308) [:1.6.0_24]

                    at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:280) [:6.0.0.Final]

                    at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:264) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1162) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:955) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]

                    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]

                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:593) [:6.0.0.Final]

                    at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

                    at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]

                    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]

                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]

                    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]

                    at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]

                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]

                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]

                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]

                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]

                    at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]

           

          The code that I'm trying to execute is:

           

                    @GET

                    @Path("basic")

                    @Produces("text/plain")

                    public void getBasic(final @Suspend(100000) AsynchronousResponse response)

                                        throws Exception {

                              Thread t = new Thread() {

                                        @Override

                                        public void run() {

                                                  try {

                                                            System.out.println("STARTED!!!!");

                                                            Thread.sleep(5000);

                                                            Response jaxrs = Response.ok("basic")

                                                                                .type(MediaType.TEXT_PLAIN).build();

                                                            response.setResponse(jaxrs);

                                                  } catch (Exception e) {

                                                            e.printStackTrace();

                                                  }

                                        }

                              };

                              t.start();

                    }

          • 2. Async RESTeasy on JBAS6
            jaikiran

            Please try asking this in the RestEasy forum https://lists.sourceforge.net/lists/listinfo/resteasy-users

            • 3. Re: Async RESTeasy on JBAS6
              alesj
              21:37:23,510 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test-async].[ResteasyAsync]] Allocate exception for servlet ResteasyAsync: java.lang.InstantiationException: org.jboss.resteasy.plugins.server.servlet.JBossWebAsyncHttpRequest

              What's the root cause in this case?

              • 4. Re: Async RESTeasy on JBAS6
                osnetwork

                I'm doing a GET request to the REST resource that is supposed to answer asynchronously