7 Replies Latest reply on Jun 1, 2011 5:28 AM by Clemens Eisserer

    RestEasy integration causes redirect-loops for "normal" pages

    Clemens Eisserer Newbie
      Hi,

      I am very new to Seam, so sorry if this a newbie question.
      I've enabled RestEasy integration by copying jboss-seam-resteasy.jar to WEB-INF/lib/ and it seems to work fine. I can reach my REST service, it returns the data that is expected.

      However normal pages don't seem to work anymore. Whithout jboss-seam-resteasy.jar by default /home.seam is loaded.
      After I copied the jar-file, I only get endless redirects when trying to access /home.seam until firefox breaks the redirect-loop.

      Any idea what could be wrong? Startup & log don't indicate any problems.

      Thank you in advance, Clemens
        • 1. Re: RestEasy integration causes redirect-loops for "normal" pages
          Clemens Eisserer Newbie
          The redirect-loop was caused by the debug-mode which was broken.
          After disabling debug mode I get tons of the following exceptions.

          Any idea what could be the reason?

          13:53:45,966 ERROR [org.jboss.seam.exception.Exceptions] handled and logged exception: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Unable to determine entity id class.
                  at org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:329) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:305) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:198) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:174) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:518) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:480) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:139) [:6.0.0.Final]
                  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:211) [:6.0.0.Final]
                  at org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59) [:6.0.0.Final]
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [:2.2.2.Final]
                  at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [:3.3.3.Final]
                  at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [:3.3.3.Final]
                  at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [:3.3.3.Final]
                  at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [:3.3.3.Final]
                  at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
                  at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [:2.2.2.Final]
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [: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:501) [: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:636) [:1.6.0_20]
          Caused by: java.lang.RuntimeException: Unable to determine entity id class.
                  at org.jboss.seam.resteasy.ResourceHome.getEntityIdClass(ResourceHome.java:363) [:2.2.2.Final]
                  at org.jboss.seam.resteasy.ResourceHome.unmarshallId(ResourceHome.java:295) [:2.2.2.Final]
                  at org.jboss.seam.resteasy.ResourceHome.getResource(ResourceHome.java:113) [:2.2.2.Final]
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_20]
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_20]
                  at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_20]
                  at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [:6.0.0.Final]
                  at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) [:6.0.0.Final]
                  at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) [:6.0.0.Final]
                  at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) [:6.0.0.Final]
                  at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:503) [:6.0.0.Final]
                  ... 46 more
          • 2. Re: RestEasy integration causes redirect-loops for "normal" pages
            zeeman Novice

            I have the same issue whenever I have jboss-seam-resteasy.jar packaged with WAR. Seam 2.2.2 with jboss AS 6. I get redirect loop in browser when accessing home.seam.

            • 3. Re: RestEasy integration causes redirect-loops for "normal" pages
              Jozef Hartinger Master

              Clemens, how are you using ResourceHome components? Do you configure then in components.xml or do you use the subclass approach? If the former, do you specify the entity-id-class attribute? Could you attach your components.xml?

              • 4. Re: RestEasy integration causes redirect-loops for "normal" pages
                Clemens Eisserer Newbie

                Hi Jozef,


                I uploaded components.xml to pastebin: http://pastebin.com/w9EFR0Hz


                The strange thing is, as soon as including jboss-seam-resteasy.jar, although my restful webservice works all other pages are broken. If I navigate to /home.seam I get an endless loop because even seam's debug site is broken now, redirecting to itself in a loop.


                It seems when including jboss-seam-resteasy.jar, it tries to handle all requests, even those which are no webservice calls at all?


                Thanks, Clemens

                • 5. Re: RestEasy integration causes redirect-loops for "normal" pages
                  zeeman Novice

                  What Clemens said is right, after looking more into this, resteasy checks all URLs even ones that are not webservices calls. It gets stuck in an endless redirect loop.


                  This is easily reproducible if you include the jboss-seam-resteasy.jar in a war with Seam 2.2


                  Any ideas? I cannot find a way to build REST services with Seam due to this bug. A major blocker. How did this pass Seam testing?

                  • 6. Re: RestEasy integration causes redirect-loops for "normal" pages
                    Jozef Hartinger Master

                    I am able to reproduce now. I opened JBSEAM-4809 to track the issue. Note that this issue only impacts JBoss AS 6. There is also an easy workaround. See the JIRA issue for details.

                    • 7. Re: RestEasy integration causes redirect-loops for "normal" pages
                      Clemens Eisserer Newbie

                      Thanks a lot. Disabling the automatic resource lookup and specifying it manually made it work.