9 Replies Latest reply on Sep 20, 2007 9:33 AM by wise_guybg

    EjbSynchronizations not bound

    wise_guybg

      Hi,

      I updated to Seam 2.0.0.CR1 and tried again (no luck in B1) to set <transaction:ejb-transaction/> in components.xml. On deploy an exception occurs:

      NameNotFoundException: EjbSynchronizations not bound


      This is the stack trace:

      15:59:24,616 ERROR [SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: Could not start transaction
      at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:571)
      at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:307)
      at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
      at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      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.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:44)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      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.servlet.SeamFilter.doFilter(SeamFilter.java:150)
      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:179)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      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:241)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:853)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1513)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
      at org.jboss.seam.Component.newInstance(Component.java:1971)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1853)
      at org.jboss.seam.Component.getInstance(Component.java:1847)
      at org.jboss.seam.transaction.AbstractUserTransaction.getSynchronizations(AbstractUserTransaction.java:79)
      at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40)
      at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:566)
      ... 46 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.server.NamingServer.lookup(NamingServer.java:270)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.seam.Component.instantiateSessionBean(Component.java:1288)
      at org.jboss.seam.Component.instantiate(Component.java:1274)
      at org.jboss.seam.Component.newInstance(Component.java:1967)
      ... 52 more


      Before the exception there is:
      15:55:41,782 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.transaction.synchronizations


      And also:
      15:55:43,244 INFO [Component] Component: org.jboss.seam.transaction.synchronizations, scope: EVENT, type: STATEFUL_SESSION_BEAN, class: org.jboss.seam.transaction.EjbSynchronizations, JNDI: ExamCenter-EE/EjbSynchronizations/local


        • 1. Re: EjbSynchronizations not bound
          pmuir

          What is your deployment environment?

          • 2. Re: EjbSynchronizations not bound
            wise_guybg

            I see Pete has replied to a lot of posts so I hope I don't get missed this time.

            I really can't turn on <transaction:ejb-transaction/> in my application. It's always the same error. And it's difficult to debug since it's the AS that throws an error.

            I found two topics:
            http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071599
            http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077142

            That both end up with the same JIRA issue:
            http://jira.jboss.com/jira/browse/JBSEAM-1771

            Unfortunately even after CR1 this doesn't work in my environment.

            opps, I saw Pete has replied (happy :)

            I use JBoss 4.2.1.GA, Seam 2.0.0.CR1. I access an Oracle 10g database.

            Here is my persistence.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">
             <persistence-unit name="examCenterDatabase" transaction-type="JTA">
             <provider>org.hibernate.ejb.HibernatePersistence</provider>
             <jta-data-source>java:SeamDS</jta-data-source>
             <properties>
             <property name="hibernate.show_sql" value="true"/>
             <property name="hibernate.max_fetch_depth" value="3"/>
             <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
             <!-- Oracle specific settings -->
             <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
             <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
             <!-- JBoss AS specific settings -->
             <property name="hibernate.transaction.manager_lookup_class"
             value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
             ...
             </properties>
             </persistence-unit>
            </persistence>
            


            and 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:mail="http://jboss.com/products/seam/mail"
             xmlns:persistence="http://jboss.com/products/seam/persistence"
             xmlns:transaction="http://jboss.com/products/seam/transaction"
             xmlns:theme="http://jboss.com/products/seam/theme"
             xmlns:international="http://jboss.com/products/seam/international"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
             http://jboss.com/products/seam/core http://jboss.com/products/seam/core-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/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/theme http://jboss.com/products/seam/theme-2.0.xsd">
            
             <core:init jndi-pattern="java:comp/env/ExamCenter-EE/#{ejbName}/local" debug="true"/>
            
             <core:manager conversation-timeout="120000"
             concurrent-request-timeout="500"
             conversation-id-parameter="cid"/>
            
             <persistence:entity-manager-factory name="examCenterEntityManagerFactory"
             persistence-unit-name="examCenterDatabase"/>
             <persistence:managed-persistence-context name="entityManager" auto-create="true"
             entity-manager-factory="#{examCenterEntityManagerFactory}"/>
             <transaction:ejb-transaction/>
            
             ...
            </components>
            


            • 3. Re: EjbSynchronizations not bound
              pmuir

              Post your application.xml. You have something odd going on with JNDI lookup paths. Your jndi-pattern should be

              <ear-name>/#{ejbName}/local

              and you should register jboss-seam.jar as an ejb module.

              • 4. Re: EjbSynchronizations not bound
                wise_guybg

                Hi, thanks for the reply.

                I have seen java:comp/env/ added to one of the examples so I thought I could give it a try. The initial post was without comp/env...

                Here is my application.xml:

                <?xml version="1.0" encoding="UTF-8"?>
                <application xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
                 version="5">
                 <display-name>ExamCenter</display-name>
                 <module id="ExamCenter-Ejb">
                 <ejb>ExamCenter-Ejb.jar</ejb>
                 </module>
                 <module id="ExamCenter-Web-Admin">
                 <web>
                 <web-uri>ExamCenter-Web-Admin.war</web-uri>
                 <context-root>ExamCenter-Web-Admin</context-root>
                 </web>
                 </module>
                </application>
                


                I'd like to ask if there is any configuration in the application server regarding jndi that should be done?

                • 5. Re: EjbSynchronizations not bound
                  wise_guybg

                  My jars are in the /lib folder of the ear. I deploy my application from an exploded folder.

                  • 6. Re: EjbSynchronizations not bound
                    wise_guybg

                    The problem was that jboss-seam.jar was also in my /lib folder. I checked out the files in the booking example and confirmed that this was the most probable cause.

                    It works now. I knew it is a configuration problem. Big thanks for the help :)

                    • 7. Re: EjbSynchronizations not bound
                      wise_guybg

                      May I ask what makes it obligatory for jboss-seam.jar to be declared as an ejb module. I think this was not required before. Any links/documentation on the subject?

                      Here is what I found:
                      http://docs.jboss.com/seam/1.3.0.ALPHA/reference/en/html/tutorial.html
                      vs
                      http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/tutorial.html

                      The jar is declared as an ejb module from B1 onward. Does this have something to do with conforming to the spec and allowing java modules to be moved to /lib?

                      • 8. Re: EjbSynchronizations not bound
                        pmuir

                        We changed our minds. It seems to work with it not as an ejb module, but as it contains ejb's (well one) it is an ejb module according to the spec.

                        • 9. Re: EjbSynchronizations not bound
                          wise_guybg

                          There must be more in that than you minds :) because if jboss-seam.jar is not declared as an ejb module and put in the root of the ear, the <transaction:ejb-transaction/> tag doesn't work.