4 Replies Latest reply on Jun 9, 2010 9:40 PM by shavo26

    WebLogic + ejb-transaction + EjbSynchronizations

    joff

      I'm hoping someone can help me with this.... it's fast becoming incredibly frustrating :(


      I'm running WebLogic 10.3, and my appliction is a mix of EJB3 (stateful) beans, and Seam POJO components. From my reading, it seems I want be using JTA transactions (is this the recommended approach?)



      persistence.xml:


          <persistence-unit name="bookItPersistenceUnit" transaction-type="JTA">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <jta-data-source>BookItDatasource</jta-data-source>
              <properties>
                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
                  <property name="hibernate.transaction.manager_lookup_class"
                            value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
              </properties>
          </persistence-unit>



      components.xml:


        <core:init debug="@debug@" jndi-pattern="java:comp/env/bookit/ejb/#{ejbName}/local" />
      
       <transaction:ejb-transaction />
      
          <persistence:entity-manager-factory name="bookItEntityManagerFactory"
                                              persistence-unit-name="bookItPersistenceUnit" />
      
          <persistence:managed-persistence-context name="entityManager"
                                                       auto-create="true"
                                                       entity-manager-factory="#{bookItEntityManagerFactory}"/>




      When I deploy, I see in the logs:



         INFO: Component: org.jboss.seam.transaction.synchronizations, scope: EVENT, type: STATEFUL_SESSION_BEAN, class:
          org.jboss.seam.transaction.EjbSynchronizations, JNDI: java:comp/env/bookit/ejb/EjbSynchronizations/local




      But when I try to access any pages in my app, I get:


      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
           at org.jboss.seam.Component.newInstance(Component.java:2106)
      ...
      Caused by: javax.naming.NameNotFoundException: While trying to look up comp/env/bookit/ejb/EjbSynchronizations/local in /app/webapp/BookIt/22293341.; remaining name 'comp/env/bookit/ejb/EjbSynchronizations/local'
           at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
           at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
           at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
           at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
           at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
           at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
           at javax.naming.InitialContext.lookup(InitialContext.java:392)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1367)
           at org.jboss.seam.Component.instantiate(Component.java:1331)
      



      I have my SFSBs and the EjbSynchronizations bean specified in my ejb.jar.xml file, as per the instructions in the docs, and an <ejb-local-ref> entry for just my beans in web.xml


        • 1. Re: WebLogic + ejb-transaction + EjbSynchronizations

          Hi Joseph,


          Just curious if you ever resolved this issue?

          • 2. Re: WebLogic + ejb-transaction + EjbSynchronizations
            joff

            No, I'm afraid we never did solve this problem.
            I could remove the <transaction:ejb-transaction/> line from components.xml, but then it complains of not being able to find the bookItEntityManagerFactory.


            We're using @Asynchronous methods (and the <async:timer-service-dispatcher /> ) in our app now, so AFAIK, this will eventually stop us from using WebLogic anyway.


            • 3. Re: WebLogic + ejb-transaction + EjbSynchronizations
              dish13

              Hello,


              Did you included the following entry in the web.xml?


              <ejb-local-ref>
                   <ejb-ref-name><EAR-NAME>/EjbSynchronizations/local</ejb-ref-name>
                   <ejb-ref-type>Session</ejb-ref-type>
                   <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
                   <ejb-link>EjbSynchronizations</ejb-link>
              </ejb-local-ref>



              Regards,


              Amy

              • 4. Re: WebLogic + ejb-transaction + EjbSynchronizations
                shavo26

                Joseph.
                I think this is the way your ejb local ref should be set based on your jndi pattern:




                 <core:init debug="@debug@" jndi-pattern="java:comp/env/bookit/ejb/#{ejbName}/local" />
                 
                  
                 <ejb-local-ref>
                    <ejb-ref-name>bookit/ejb/EjbSynchronizations/local</ejb-ref-name>
                    <ejb-ref-type>Session</ejb-ref-type>
                    <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
                  </ejb-local-ref>