6 Replies Latest reply on Aug 29, 2008 7:32 PM by npacemo

    Redirect Loop with lots of exceptions from seam-booking example

    npacemo

      I'm trying to get running the seam-booking example inside Eclipse Ganymede with the new alpha release of JBoss Tools and JBoss Seam 2.0.2.SP1 and here's the structure of the projects I've setup:


      -booking (Seam Web Project)
        -src
          -messages.properties
        -resources (this is the web content folder)
          +css
          +exp
          +img
          -META-INF
            -MANIFEST.MF
          -WEB-INF
            +lib
            -components.xml
            -faces-config.xml
            -jboss-web.xml
            -pages.xml
            -web.xml
          -*.xhtml
          ... (xhtmls go here)
      
      -booking-ear (Java EAR Project)
        -EarContent
          -META-INF
            -application.xml
            -jboss-app.xml
            -MANIFEST.MF
          -*.jar
          ... (other needed jars go here)
        -resources
          -booking-ds.cml
      
      -booking-ejb (EJB3 Project)
        -ejbModule
          -org.jboss.seam.example.booking
            -*.java
            ... (all java classes go here)
          -META-INF
            -ejb-jar.xml
            -MANIFEST.MF
            -persistence.xml
          -components.properties
          -import.sql
          -seam.properties
        -booking-ejb.launch
        -hibernate-console.properties



      This is basically the standard structure you get when you're doing a setup of a Seam Web Project deployed as an EAR. I've just added the classes from the seam-booking example, as well as the xhtmls and all configuration files (just slightly edited them to conform with my local database connection).


      The deployment of the application looks fine in the logs, have a few warnings though:


      10:56:28,879 WARN  [MainDeployer] Found non-jar deployer for jboss-seam.jar: MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
      10:56:29,160 WARN  [DeploymentInfo] Only the root deployment can set the loader repository, ignoring config=LoaderRepositoryConfig(repositoryName: seam.jboss.org:loader=booking, repositoryClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3, configParserClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3ConfigParser, repositoryConfig: java2ParentDelegation=false)
      10:56:29,453 WARN  [MainDeployer] Found non-jar deployer for jboss-seam.jar: MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
      ...
      10:56:32,832 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext



      The application is up and running, but when I'm trying to access http://localhost:8080/booking I'm getting a redirect loop error in the browser - no error page, no nothing, just exceptions in the log. The exception appear to be caused recursively, because they're repeating until the Console in the Eclipse is full with output, but there is a repeating pattern:


      11:00:19,567 ERROR [SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: Could not commit transaction
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
           at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:613)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           at org.jboss.seam.Component.getInstance(Component.java:1876)
           at org.jboss.seam.Component.getInstance(Component.java:1855)
           at org.jboss.seam.Component.getInstance(Component.java:1849)
           at org.jboss.seam.transaction.AbstractUserTransaction.getSynchronizations(AbstractUserTransaction.java:79)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:48)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
           ... 40 more
      Caused by: javax.naming.NameNotFoundException: EjbSynchronizations not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
           at javax.naming.InitialContext.lookup(InitialContext.java:351)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1290)
           at org.jboss.seam.Component.instantiate(Component.java:1276)
           at org.jboss.seam.Component.newInstance(Component.java:1970)
           ... 46 more
      11:00:19,591 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction



      Thank you in advance for any suggestions or requests to put additional information to solve this problem.


      Best Regards

        • 1. Re: Redirect Loop with lots of exceptions from seam-booking example
          blabno

          Show components.xml and location of libs in archive. (list all libs)

          • 2. Re: Redirect Loop with lots of exceptions from seam-booking example
            npacemo

            This is the contents of components.xml:


            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
                        xmlns:core="http://jboss.com/products/seam/core"
                        xmlns:security="http://jboss.com/products/seam/security"
                        xmlns:transaction="http://jboss.com/products/seam/transaction"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation=
                            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
            
                <core:init jndi-pattern="@jndiPattern@" debug="true"/>
            
                <core:manager conversation-timeout="120000"
                              concurrent-request-timeout="500"
                              conversation-id-parameter="cid"/>
            
                <transaction:ejb-transaction/>
            
                <security:identity authenticate-method="#{authenticator.authenticate}"/>
            
            </components>



            Here's the structure of the EAR as deployed to the server:


            -booking-ear.ear
              +booking-ejb.jar (no libs here, just a classpath MANIFEST.MF in META-INF)
              -booking.war
                +css
                +exp
                +img
                +META-INF
                -WEB-INF
                  +classes
                  -lib
                    -antlr-runtime.          jarjboss-seam-debug.jar jbpm-jpdl.jar
                    -commons-beanutils.jar   jboss-seam-ioc.jar      jsf-facelets.jar
                    -commons-digester.jar    jboss-seam-mail.jar     mvel14.jar
                    -core.jar                jboss-seam-pdf.jar      richfaces-api.jar
                    -drools-compiler.jar     jboss-seam-remoting.jar richfaces-impl.jar
                    -drools-core.jar         jboss-seam-ui.jar       richfaces-ui.jar
                    -jboss-el.jar            jboss-seam.jar
                  -*.xml
                -*.xhtml
              -META-INF
              -antlr-runtime.jar
              -drools-compiler.jar
              -drools-core.jar
              -jboss-el.jar
              -jboss-seam.jar
              -jbpm-jpdl.jar
              -mvel14.jar
              -richfaces-api.jar

            • 3. Re: Redirect Loop with lots of exceptions from seam-booking example
              blabno

              Remember : do not put the same library twice in the same EAR !


              Most important : remove from booking.war/WEB-INF/lib/ following libs :



              • jboss-seam.jar

              • jboss-el.jar

              • jbpm-jpdl.jar



              Personally I keep following libs in EAR/lib and have Class-Path: lib/ in war/META-INF/MANIFEST.MF :



              • commons-beanutils.jar

              • commons-digester.jar

              • jboss-el.jar

              • jbpm-jpdl.jar


              • 4. Re: Redirect Loop with lots of exceptions from seam-booking example
                patrickmadden.patrickmadden.clooster.com

                see this post. I literally just solved the same problem.


                Hopefully solves your problem


                Scroll down to the bottom.


                PVm

                • 5. Re: Redirect Loop with lots of exceptions from seam-booking example
                  npacemo

                  Currently there are no jar duplications in the EAR:


                  vladimir-tsvetkovs-computer:~/java/jboss-4.2.3.GA/server/default/deploy/booking-ear.ear vladimirtsvetkov$ find -f . | grep -e **jar$
                  ./antlr-runtime.jar
                  ./booking-ejb.jar
                  ./booking.war/WEB-INF/lib/commons-beanutils.jar
                  ./booking.war/WEB-INF/lib/commons-digester.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-debug.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-ioc.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-mail.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-pdf.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-remoting.jar
                  ./booking.war/WEB-INF/lib/jboss-seam-ui.jar
                  ./booking.war/WEB-INF/lib/jsf-facelets.jar
                  ./booking.war/WEB-INF/lib/richfaces-impl.jar
                  ./booking.war/WEB-INF/lib/richfaces-ui.jar
                  ./drools-compiler.jar
                  ./drools-core.jar
                  ./jboss-el.jar
                  ./jboss-seam.jar
                  ./jbpm-jpdl.jar
                  ./mvel14.jar
                  ./richfaces-api.jar
                  



                  But the problem is persisting.
                  Some things look suspicious to me, like the transaction:ejb-transaction tag in components.xml, as well as the jndi-pattern in the same file inside the deployed EAR. Should the @jndiPattern@ be substituted with concrete jndi-pattern before deployment or JBoss is used to do the magic when starting the application?



                  • 6. Re: Redirect Loop with lots of exceptions from seam-booking example
                    npacemo

                    The application start working right after I've changed the transaction:ejb-transaction tag with persistence:managed-persistence-context tag.


                    Here's the components.xml I'm using now:


                    <?xml version="1.0" encoding="UTF-8"?>
                    <components xmlns="http://jboss.com/products/seam/components"
                                xmlns:core="http://jboss.com/products/seam/core"
                                xmlns:persistence="http://jboss.com/products/seam/persistence"
                                xmlns:transaction="http://jboss.com/products/seam/transaction"
                                xmlns:drools="http://jboss.com/products/seam/drools"
                                xmlns:bpm="http://jboss.com/products/seam/bpm"
                                xmlns:security="http://jboss.com/products/seam/security"
                                xmlns:mail="http://jboss.com/products/seam/mail"
                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xsi:schemaLocation=
                                    "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                                     http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                                     http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd 
                                     http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
                                     http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
                                     http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                                     http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
                                     http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                    
                       <core:init debug="true" jndi-pattern="@jndiPattern@"/>
                         
                       <core:manager concurrent-request-timeout="500" 
                                     conversation-timeout="120000" 
                                     conversation-id-parameter="cid"/>
                        
                       <persistence:managed-persistence-context name="entityManager"
                                          auto-create="true"
                                          persistence-unit-jndi-name="java:/bookingEntityManagerFactory"/>
                       
                       
                       <!-- 
                       <transaction:ejb-transaction/>
                        -->
                    
                       <security:identity authenticate-method="#{authenticator.authenticate}"/>
                          
                    </components>
                    



                    Still curious why this is not working with the previous configuration - when I'm building the example right from the examples directory of JBoss Seam it is working just fine - I'm missing something in the ejb-transaction configuration, but need to invest time to find out where I'm wrong.


                    Thank you very much for the help!