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

    WebLogic + ejb-transaction + EjbSynchronizations

    Joseph Miller Newbie

      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