8 Replies Latest reply on Mar 27, 2009 12:00 PM by Jens Weintraut

    EjbSynchronizations not bound

    Jens Weintraut Apprentice

      Hi,


      I had to rename my Seam project and now I have a problem with <transaction:ejb-transaction /> in components.xml. My application uses Seam 2.0.1.GA, ICEfaces 1.7.1 and runs on a JBoss AS 4.2.2.GA.
      After the ear is deployed and the server started I try to use the application but this stacktrace occurs:



      2008-09-30 09:58:32,953 DEBUG [org.jboss.seam.transaction.UTTransaction] beginning JTA transaction
      2008-09-30 09:58:32,953 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.transaction.synchronizations
      2008-09-30 09:58:32,953 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      2008-09-30 09:58:32,953 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: Could not start transaction
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:581)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:312)
           at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:140)
           at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
           at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:25)
           at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:161)
           at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
           at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:30)
           at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:48)
           at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
           at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
           at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
           at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
           at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
           at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
           at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
           at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
           at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
           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.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:179)
           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(Unknown Source)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
           at org.jboss.seam.Component.newInstance(Component.java:1970)
           at org.jboss.seam.Component.getInstance(Component.java:1873)
           at org.jboss.seam.Component.getInstance(Component.java:1852)
           at org.jboss.seam.Component.getInstance(Component.java:1846)
           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:576)
           ... 51 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:667)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
           at javax.naming.InitialContext.lookup(Unknown Source)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1287)
           at org.jboss.seam.Component.instantiate(Component.java:1273)
           at org.jboss.seam.Component.newInstance(Component.java:1966)
           ... 57 more



      The funny thing is that the component org.jboss.seam.transaction.synchronizations is created:



      2008-09-30 09:58:26,446 INFO  [org.jboss.seam.Component] Component: org.jboss.seam.transaction.synchronizations, scope: EVENT, type: STATEFUL_SESSION_BEAN, class: org.jboss.seam.transaction.EjbSynchronizations, JNDI: YTrack/EjbSynchronizations/local



      This is my application.xml:



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



      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:mail="http://jboss.com/products/seam/mail"
        xmlns:persistence="http://jboss.com/products/seam/persistence"
        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
          http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd">
        
          <core:init   jndi-pattern="YTrack/#{ejbName}/local"
                transaction-management-enabled="true"
                debug="false"
                />
          
          <core:manager  concurrent-request-timeout="500"
                  conversation-id-parameter="cid"
                  conversation-timeout="120000"
                  />
          
          <core:resource-loader>
                  <core:bundle-names>
                      <value>com.idsscheer.ares.resources.ares_messages</value>
                  </core:bundle-names>
              </core:resource-loader>
          
          <!-- <transaction:ejb-transaction /> -->
          
          <persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:/entityManagerFactories/aresData"/>
          
          <security:identity authenticate-method="#{login.authenticate}" remember-me="false"/>
          
          <event type="org.jboss.seam.security.notLoggedIn">
            <action execute="#{redirect.captureCurrentView}"/>
          </event>
          
          <event type="org.jboss.seam.security.postAuthenticate">
            <action execute="#{redirect.returnToCapturedView}"/>
          </event>
          
          <component name="statistics">
            <property name="mailHost">049SBEVS1.me.corp.ids-scheer.com</property>
            <property name="applicationURL">http://localhost:8080/ares/</property>
          </component>
      
          <component auto-create="true" class="com.idsscheer.ares.business.UpDownloadFilesystem" name="upDownload" scope="session">
            <property name="tempDir">T:\\aresTemp</property>
            <property name="filesDir">T:\\aresAnubisDump</property>
          </component>
          
          
          <component name="com.idsscheer.ares.view.converter.BugfixValidationConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.BuildConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.ComponentConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.DBVersionConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.DefectcauseConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.EnvironmentConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.JavaversionConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.PriorityConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.ReleaseConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.ReleaseReleasegroupConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.ReleasestatusConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.RequestuserConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.RevisionConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.SeverityConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.TestcaseConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.TestsequenceConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.UserConverter">
            <property name="entityManager">#{em}</property>
          </component>
          <component name="com.idsscheer.ares.view.converter.UserUsergroupConverter">
            <property name="entityManager">#{em}</property>
          </component>
      </components>



      I don't know what else could be wrong in my configuration. If I comment out this <transaction:ejb-transaction /> the application can be started. But since I don't know if there are drawbacks if I don't use <transaction:ejb-transaction /> I would really like to use it.


      Thanks in advance
      Jens

        • 1. Re: EjbSynchronizations not bound
          Guillaume Jeudy Master

          Hi Jens,


          Seam can't find the EJB in the EJB container as testifies this line:


          Caused by: javax.naming.NameNotFoundException: EjbSynchronizations not bound
               at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)



          Check the JNDI view in the jmx-console to see under which name this component is published by JBoss when it deploys the EJB. This name must match the pattern found in your components.xml:


          <core:init   jndi-pattern="YTrack/#{ejbName}/local"
                    transaction-management-enabled="true"
                    debug="false"
                    />
          


          • 2. Re: EjbSynchronizations not bound
            Dean Hiller Expert

            I am hitting the same EXACT problem but with JBoss5.0CR2 and with the example booking application(no changes to application) in seam 2.0.2SP1.  Does anyone else have the booking application working in JBoss 5.0.


            Also, to get it working, I had to add a datasource for postgres, otherwise it fails earlier(and the seam walkthrough in 2.0.2 said nothing about setting up the datasource so I am wondering if it is missing another step too that I need to do).
            thanks,
            Dean

            • 3. Re: EjbSynchronizations not bound
              Dean Hiller Expert

              oh yeah, I see like the previous poster seam loading the EjbSynchronizations component but it is not in the JMX console at all.  Steps to reproduce....


              1. build examples/booking project in seam
              2. add datasource in jboss(with jdbc jars as well)
              3. run jboss
              4. hit the url of http://localhost:8080/jboss-seam-booking


              The failure happens on step 4, NOT step 3.
              Dean

              • 4. Re: EjbSynchronizations not bound
                Dean Hiller Expert

                I get the same problem on Jboss 4.2.2 GA.


                interesting thing to note is I do not need to set up the Datasource on 4.2.2 for it to get to this point while on 5.0 I do have to setup a datasource

                • 5. Re: EjbSynchronizations not bound
                  Dean Hiller Expert

                  oh yeah, I don't see a build option to build an ear(nor do I really want an ear anyways)....but could that be the problem is that the examples only allow building a war


                  ant jbosswar.archive


                  thanks,
                  Dean

                  • 6. Re: EjbSynchronizations not bound
                    Jens Weintraut Apprentice

                    Thanks for your advice. I checked the JMX console and there was only one entry for EjbSynchronizations (whether <transaction:ejb-transaction /> is set or not):



                    MBean Name:
                           Domain Name:       jboss.j2ee
                         service:      EJB3
                         name:      EjbSynchronizations
                         jar:      jboss-seam.jar
                    MBean Java Class:     org.jboss.ejb3.stateful.StatefulDelegateWrapper



                    I'm wondering why the name is EjbSynchronizations, shouldn't it be something like YTrack/EjbSynchronizations/local? But I see from the JMX console that every MBean has such a name. So I think EjbSynchronizations is up and running. The question is: Why can't Seam find it?


                    Thanks in advance
                    Jens

                    • 7. Re: EjbSynchronizations not bound
                      Jens Weintraut Apprentice

                      Last year I just disabled EJBSynchronizations by removing the tag <transaction:ejb-transaction /> from components.xml.


                      But I'm refactoring my application at the moment and I really would like to get the benefits of a seam-managed persistence context and Seam's transaction support. I'm using JBoss AS 4.2.2, Seam 2.0.2.SP1 and ICEfaces 1.7.2.SP1. As soon as ICEfaces 1.8.0 is final I'm going to update all frameworks to their current versions (JBoss AS 5.0, Seam 2.1 and ICEfaces 1.8.0).


                      So my problem still is that adding the tag <transaction:ejb-transaction /> to my components.xml results in an exception which tells me: EjbSynchronizations not bound. From some posts I collected the information that



                      • I have to ensure that jboss-seam.jar is added as module

                      • I have to use <EAR name>/#{ejbName}/local for my JNDI pattern

                      • I have to include the tag transaction:ejb-transaction /> in components.xml



                      on order to let seam really manage transactions with container-managed JTA. I'm pretty sure I have done this right but it still doesn't work.


                      Here is an excerpt from my 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:mail="http://jboss.com/products/seam/mail"
                        xmlns:persistence="http://jboss.com/products/seam/persistence"
                        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
                          http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd">
                      
                          <core:init   jndi-pattern="YTrack/#{ejbName}/local"
                                transaction-management-enabled="true"
                                debug="false"
                                />
                      
                          <persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:/YTrackEntityManagerFactory"/>
                      
                          <transaction:ejb-transaction />
                      </components>



                      And here my application.xml:


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



                      The structure of the EAR is as follows:


                      YTrack.ear
                      + /lib
                        backport-util-concurrent.jar
                        commons-beanutils.jar
                        commons-digester.jar
                        commons-email.jar
                        commons-fileupload.jar
                        icefaces-comps.jar
                        icefaces-facelets.jar
                        icefaces.jar
                        jboss-el.jar
                      + /META-INF
                        application.xml
                        jboss-app.xml
                        MANIFEST.MF
                      jboss-seam.jar
                      YTrackEJB.jar
                        + /com/...
                        + /META-INF
                          ejb-jar.xml
                          MANIFEST.MF
                          persistence.xml
                        seam.properties
                      YTrackWeb.war
                        + /css
                        + /img
                        + /js
                        + /META-INF
                          MANIFEST.MF
                        + /WEB-INF
                          + /classes (for resource properties)
                          + /lib
                            jboss-seam-debug.jar
                            jboss-seam-gen.jar
                            jboss-seam-ioc.jar
                            jboss-seam-mail.jar
                            jboss-seam-pdf.jar
                            jboss-seam-remoting.jar
                            jboss-seam-ui.jar
                          components.xml
                          faces-config.xml
                          icefaces_component.tld
                          pages.xml
                          web.xml
                        *.xhtml files



                      Would be a pleasure to get a hint what's wrong with my configuration.


                      Thanks in advance
                      Jens

                      • 8. Re: EjbSynchronizations not bound
                        Jens Weintraut Apprentice

                        I knew it's neither Seam nor any other framework that was to blame for this exception. It's my mistake again, I think :D


                        I had a closer look at the stacktrace and recognized this line:


                        at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40)


                        This line tells me, that Seam uses UTTransaction as transaction manager which relies on the application-managed JTA UserTransaction (according to the great Seam in Action). It's the default in non-EJB environments and doesn't need transaction:ejb-transaction /> to be setup.
                        But since I use JBoss AS 4.2.2.GA and I'm declaring my beans as EJB beans I thought my application lived in an EJB environment. In that case Seam would need this tag since it would use CMTTransaction as transaction manager which itself uses the container-managed JTA UserTransaction.


                        Now I'm wondering why my application doesn't run in an EJB environment?!?