14 Replies Latest reply on Feb 19, 2008 7:41 PM by Neil C

    Odd Transactional Exception on WebLogic 9.2

    Neil C Novice

      Using Seam 2.0 GA on WebLogic 9.2, I am trying to simply populate a dropdown list with values from a database table. The code to do so is in a Seam-managed persistence component and has been tested and found to work. My Facelet then calls on this component to populate the dropdown. When I do so, I get this:



      Caused by: java.sql.SQLException: Transaction BEA1-02F463ADA554FEA2ACBA not active anymore. tx statu
      s = Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException]
           at weblogic.jdbc.jts.Driver.getTransaction(Driver.java:564)
           at weblogic.jdbc.jts.Driver.connect(Driver.java:121)
           at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
           at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider
      .java:69)
           at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
           at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
           at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
           at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
           at org.hibernate.loader.Loader.doQuery(Loader.java:673)
           at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
           at org.hibernate.loader.Loader.doList(Loader.java:2220)
           at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
           at org.hibernate.loader.Loader.list(Loader.java:2099)
           at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
           at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
           at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
           at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
           at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
           at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
           at gov.nist.srm.persistence.QueryServiceImpl.getTechnicalCategories(QueryServiceImpl.java:31)
           at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.la
      ng.Object;(Unknown Source)
           at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknow
      n Source)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      



      As I said, this is a basic readonly operation from the database. At no point do I call for any rollback. Also, the datasource has been tested in the WebLogic console and found to work.


      Here are the properties in persistence.xml:



      <properties>
               <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
               <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
               <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
               <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>
      </properties>



      Finally, here is the code:



      @Name("queryService")
      public class QueryServiceImpl extends Object implements QueryService, Serializable {
           @Transactional(TransactionPropagationType.SUPPORTS)
           public List<Category> getCategories() { ... }
      .
      .
      .
      }



      And here is the reference in the Facelet:



      <select jsfc="h:selectOneMenu" id="categoryDropdown" value="#{myAction.category}">
            <s:selectItems value="#{queryService.categories}" var="category" label="#{category.name}" noSelectionLabel="" />
      </select>



      I should note that if I remove that @Transactional annotation, there is no change.


      Any insight into what causes this bizarre rollback on WebLogic is appreciated. Please let me know if you need more information.


      Thanks.

        • 1. Re: Odd Transactional Exception on WebLogic 9.2
          Neil C Novice

          From my application log:



          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no erro
          rs
          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - HQL: from com.myApp.pers
          istence.TechnicalCategory
          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select technicalc0_
          .ID as ID0_, technicalc0_.CREATED_BY_USER_ID as CREATED8_0_, technicalc0_.DATE_CREATED as DATE2_0_, 
          technicalc0_.DATE_UPDATED as DATE3_0_, technicalc0_.UPDATED_BY_USER_ID as UPDATED7_0_, technicalc0_.
          VERSION as VERSION0_, technicalc0_.NAME as NAME0_, technicalc0_.CATEGORY_NUMBER as CATEGORY6_0_ from
           CATEGORY technicalc0_
          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no erro
          rs
          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.engine.query.HQLQueryPlan - HQL param location recogni
          tion took 0 mills (from TechnicalCategory)
          15 Feb 2008 13:19:02,245: DEBUG org.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
          
          15 Feb 2008 13:19:29,294: DEBUG org.richfaces.skin.SkinFactory - Class name for SkinFactory set to o
          rg.richfaces.skin.SkinFactoryImpl by META-INF/services
          15 Feb 2008 13:19:29,304: DEBUG org.richfaces.skin.SkinFactoryImpl - Create new Skin instance for na
          me classic 
          15 Feb 2008 13:20:19,297: DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 492789
          6039903232
          15 Feb 2008 13:20:19,327: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,327: DEBUG org.hibernate.ejb.AbstractEntityManagerImpl - Looking for a JTA tran
          saction to join
          15 Feb 2008 13:20:19,327: WARN  org.hibernate.ejb.AbstractEntityManagerImpl - Cannot join transactio
          n: do not override hibernate.transaction.factory_class
          15 Feb 2008 13:20:19,638: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,638: DEBUG org.hibernate.impl.SessionImpl - setting flush mode to: MANUAL
          15 Feb 2008 13:20:19,648: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,648: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,658: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
          n cache (from TechnicalCategory)
          15 Feb 2008 13:20:19,708: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,708: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,708: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
          n cache (from TechnicalCategory)
          15 Feb 2008 13:20:19,708: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,718: DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from TechnicalCatego
          ry
          15 Feb 2008 13:20:19,718: DEBUG org.hibernate.engine.QueryParameters - named parameters: {}
          15 Feb 2008 13:20:19,728: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,788: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,798: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,798: DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement
           (open PreparedStatements: 0, globally: 0)
          15 Feb 2008 13:20:19,798: DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
          15 Feb 2008 13:20:19,858: DEBUG org.hibernate.util.JDBCExceptionReporter - Cannot open connection [?
          ??]
          java.sql.SQLException: Transaction BEA1-02FA63ADA554 not active anymore. tx status = Rolled back. [R
          eason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 33 seconds 
          BEA1-02FA63ADA554]
               at weblogic.jdbc.jts.Driver.getTransaction(Driver.java:564)
               at weblogic.jdbc.jts.Driver.connect(Driver.java:121)
               at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
               at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider
          .java:69)
               at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
               at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
               at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
               at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
               at org.hibernate.loader.Loader.doQuery(Loader.java:673)
               at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
               at org.hibernate.loader.Loader.doList(Loader.java:2220)
               at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
               at org.hibernate.loader.Loader.list(Loader.java:2099)
               at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
               at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
               at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
               at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
               at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
               at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
               at com.myApp.persistence.QueryServiceImpl.getTechnicalCategories(QueryServiceImpl.java:31)
               at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.la
          ng.Object;(Unknown Source)
               at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknow
          n Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
          15 Feb 2008 13:20:19,868: WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: n
          ull
          15 Feb 2008 13:20:19,868: ERROR org.hibernate.util.JDBCExceptionReporter - Transaction BEA1-02FA63AD
          A554 not active anymore. tx status = Rolled back. [Reason=weblogic.transaction.internal.TimedOutExce
          ption: Transaction timed out after 33 seconds 
          BEA1-02FA63ADA554]
          15 Feb 2008 13:20:19,868: DEBUG org.hibernate.jdbc.JDBCContext - after autocommit
          15 Feb 2008 13:20:19,868: DEBUG org.hibernate.impl.SessionImpl - after transaction completion
          15 Feb 2008 13:20:19,898: DEBUG org.hibernate.ejb.AbstractEntityManagerImpl - mark transaction for r
          ollback
          15 Feb 2008 13:20:19,898: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:19,898: ERROR org.hibernate.ejb.AbstractEntityManagerImpl - Unable to mark for rol
          lback on PersistenceException: 
          java.lang.IllegalStateException: Cannot mark the transaction for rollback. xid=BEA1-02FA63ADA554, st
          atus=Rolled back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out aft
          er 33 seconds 
          BEA1-02FA63ADA554]
               at weblogic.transaction.internal.TransactionImpl.throwIllegalStateException(TransactionImpl.java:17
          93)
               at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImpl.java:534)
               at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java
          :316)
               at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java
          :309)
               at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:433)
               at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
          java:588)
               at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
          java:630)
               at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
               at com.myApp.persistence.QueryServiceImpl.getTechnicalCategories(QueryServiceImpl.java:31)
               at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.la
          ng.Object;(Unknown Source)
               at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknow
          n Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
               at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
               at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
               at com.myApp.persistence.QueryServiceImpl_$$_javassist_3.getTechnicalCategories()Ljava.util.List;(Q
          ueryServiceImpl_$$_javassist_3.java:???)
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
          n cache (from TechnicalCategory)
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
          n cache (from TechnicalCategory)
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from TechnicalCatego
          ry
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.engine.QueryParameters - named parameters: {}
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement
           (open PreparedStatements: 1, globally: 1)
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.util.JDBCExceptionReporter - Cannot open connection [?
          ??]
          java.sql.SQLException: Transaction BEA1-02FA63ADA554 not active anymore. tx status = Rolled back. [R
          eason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 33 seconds 
          BEA1-02FA63ADA554]
               at weblogic.jdbc.jts.Driver.getTransaction(Driver.java:564)
               at weblogic.jdbc.jts.Driver.connect(Driver.java:121)
               at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
               at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider
          .java:69)
               at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
               at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
               at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
               at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
               at org.hibernate.loader.Loader.doQuery(Loader.java:673)
               at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
               at org.hibernate.loader.Loader.doList(Loader.java:2220)
               at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
               at org.hibernate.loader.Loader.list(Loader.java:2099)
               at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
               at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
               at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
               at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
               at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
               at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
               at com.myApp.persistence.QueryServiceImpl.getTechnicalCategories(QueryServiceImpl.java:31)
               at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.la
          ng.Object;(Unknown Source)
               at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknow
          n Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
          15 Feb 2008 13:20:20,439: WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: n
          ull
          15 Feb 2008 13:20:20,439: ERROR org.hibernate.util.JDBCExceptionReporter - Transaction BEA1-02FA63AD
          A554 not active anymore. tx status = Rolled back. [Reason=weblogic.transaction.internal.TimedOutExce
          ption: Transaction timed out after 33 seconds 
          BEA1-02FA63ADA554]
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - after autocommit
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.impl.SessionImpl - after transaction completion
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.ejb.AbstractEntityManagerImpl - mark transaction for r
          ollback
          15 Feb 2008 13:20:20,439: DEBUG org.hibernate.jdbc.JDBCContext - TransactionFactory reported no acti
          ve transaction; Synchronization not registered



          I should also mention that my driver is weblogic.jdbc.oracle.OracleDriver.


          Please let me know if you need more.


          Thanks.     

          • 2. Re: Odd Transactional Exception on WebLogic 9.2
            Neil C Novice

            So here is something interesting!


            I added some more debug statements to my code and found this:



            15 Feb 2008 15:39:19,847: DEBUG com.myapp.persistence.QueryServiceImpl - Executed query
            15 Feb 2008 15:39:19,847: DEBUG com.myapp.persistence.QueryServiceImpl - Ending method getCategories
             with 29 categories.
            15 Feb 2008 15:39:21,499: DEBUG com.myapp.persistence.QueryServiceImpl - Starting method getCategori
            es
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
            n cache (from Category)
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan i
            n cache (from Category)
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from Category
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.engine.QueryParameters - named parameters: {}
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement
             (open PreparedStatements: 0, globally: 0)
            15 Feb 2008 15:39:21,499: DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
            15 Feb 2008 15:39:21,569: DEBUG org.hibernate.util.JDBCExceptionReporter - Cannot open connection [?
            ??]
            java.sql.SQLException: Transaction BEA1-02FE63ADA554FEA2ACBA not active anymore. tx status = Marked 
            rollback. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException]
                 


            Put a bit more succinctly, the getCategories method actually works! I see the categories themsleves listed as they should be in the log. But for some reason, the getCategories method gets called again, and it is that second call that generates the exception I described originally.


            Any insight into why this might happen is greatly appreciated.


            Thanks.

            • 3. Re: Odd Transactional Exception on WebLogic 9.2
              Neil C Novice

              Though this might be a long shot, it occurred to me that I might be using <s:selectItems> incorrectly. In my case, when I do the following in my Facelet as described above:



              <select jsfc="h:selectOneMenu" id="categoryDropdown" value="#{myAction.category}">
                    <s:selectItems value="#{queryService.categories}" var="category" label="#{category.name}" noSelectionLabel="" />
              </select>



              ...the method queryService.categories returns a List<Category> object. It was my assumption that the Seam control constructs a List<SelectItem> from that, but I might be mistaken.


              Any clarification here is much appreciated. It may have absolutely nothing to do with this odd problem, but at this point I am desperate. I am sure you can relate.


              Thanks.

              • 5. Re: Odd Transactional Exception on WebLogic 9.2
                Neil C Novice

                Sorry, Christian, but I am totally confused.  I am not sure how a JIRA issue related to exception handling relates to my situation. 


                Unless...you are saying that the transaction rollback is being caused by an exception that occurs when processing page actions, and that the exception is swallowed by SeamPhaseListener.  That may be so, but I do not see anything in the WebLogic logs relating to an exception. 


                I cannot imagine anything less trivial than a readonly query to populate a dropdown from a database query, so I cannot figure out how there could be an exception at all.  If there is a better way than the approach I am using and it works on WebLogic, I will be happy to hear it.


                Also, any insight into the behavior found in the logs is useful.  As the Facelet is being processed, my queryService component method hits the database and gets the information it needs and exits.  Then inexplicably, the same method starts again.  Why would that be?  It is on this redo that the exception occurs.  Are you suggesting the redo is a result of some unknown exception and that the AppSetRollbackOnlyException is merely the evidence of it after the fact?


                Thanks.

                • 6. Re: Odd Transactional Exception on WebLogic 9.2
                  Christian Bauer Master

                  In all situations I encountered, Transaction is not active is an exception that is thrown after another exception, which occurred earlier, forced a rollback of the transaction. Since Seams exception handling often logs and swallows exceptions (so it can get to the exception handling phase), the final exception you see is often secondary.

                  • 7. Re: Odd Transactional Exception on WebLogic 9.2
                    Neil C Novice

                    Ahhh yes, that is what I thought you were saying.


                    There is this interesting nugget in the log:



                    java.lang.IllegalStateException: Cannot mark the transaction for rollback. xid=BEA1-02FA63ADA554, st
                    atus=Rolled back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out aft
                    er 33 seconds 
                    BEA1-02FA63ADA554]
                         at weblogic.transaction.internal.TransactionImpl.throwIllegalStateException(TransactionImpl.java:17
                    93)
                         at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImpl.java:534)
                         at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java
                    :316)
                         at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java
                    :309)
                         at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:433)
                         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
                    java:588)
                         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
                    java:630)
                         at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
                         at com.myApp.persistence.QueryServiceImpl.getTechnicalCategories(QueryServiceImpl.java:31)
                         at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.la
                    ng.Object;(Unknown Source)
                         at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknow
                    n Source)
                         at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                         at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                         at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                         at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                         at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
                         at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
                         at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
                         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                         at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                         at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                         at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
                         at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
                         at com.myApp.persistence.QueryServiceImpl_$$_javassist_3.getTechnicalCategories()Ljava.util.List;(Q
                    ueryServiceImpl_$$_javassist_3.java:???)



                    It seems like the cause of my pain is this:


                    Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 33 seconds BEA1-02FA63ADA554


                    I suppose I need to figure out why that is.  And how this relates to my code being run twice.


                    Thanks.

                    • 8. Re: Odd Transactional Exception on WebLogic 9.2
                      Neil C Novice

                      As I research weblogic.transaction.internal.TimedOutException, I am led to ask certain questions:




                      • How does Seam actually start and commit a transaction?  Recall that queryService.getCategories() is called from the Facelet directly and not within a Seam action--though queryService is itself a Seam-managed component.  What consequences does this have with regard to transactions?

                      • That queryService component I keep talking about is a one-stop shop for executing queries I have defined in orm.xml (This is a JPA application).  It is a stateless utility class.  How can I define that certain methods, like say the getCategories() method that is causing all this mess, don't need a transaction since they are readonly?



                      I assure you I have done my research both on Seam and WebLogic, but I cannot seem to find clear answers to these questions.  Any insight is appreciated.


                      Thanks.

                      • 9. Re: Odd Transactional Exception on WebLogic 9.2
                        Neil C Novice

                        Something occurred to me after reading the Seam documentation:




                        Seam provides a transaction management abstraction for beginning, committing, rolling back, and synchronizing with a transaction. By default Seam uses a JTA transaction component that integrates with Container Managed and programmatic EJB transactions.

                        Sure I am using POJOs.  However, if Seam provides its own transactional management capability and WebLogic has its own transactional management capability, then perhaps they are duplicating effort.  WebLogic transactions, as I recall from my past with EJB 2.x, were specified in ejb-jar.xml.  Since I am using a datasource in WebLogic, is there some transaction machinery that runs by default when that datasource is used to hit the database?  Since I never specified any sort of CMT mechanism nor called tx.commit(), for example, WebLogic might think the transaction is going on too long and throws the TimedOutException, which in turn results in the AppSetRollbackOnlyException.


                        For those WebLogic experts out there, are my assumptions correct?  If so, how can I turn off WebLogic's default transaction management apparatus and just use Seam's?


                        Any insight is appreciated.


                        Thanks.

                        • 10. Re: Odd Transactional Exception on WebLogic 9.2
                          Gavin King Master

                          As long as you have correctly configured Hibernate and Seam to integrate with WebLogic's container transactions, there should not be a problem. You have to tell Hibernate what TransactionManagerLookup to use, and you have to make sure that both Seam and Hibernate are controlling transactions via JTA.

                          • 11. Re: Odd Transactional Exception on WebLogic 9.2
                            Gavin King Master

                            Define what you mean by don't need a transaction since they are readonly.


                            We still strongly recommend that all data access takes place inside a well-defined transaction.

                            • 12. Re: Odd Transactional Exception on WebLogic 9.2
                              Neil C Novice

                              By readonly, I simply meant that the query is a select statement from a single table, so I could avoid the overhead associated with transaction demarcation.  I read about such a thing in Mike Keith's EJB3/JPA book. 


                              Still, if you recommend that all data access takes place inside a well-defined transaction, I am fine with that.  In fact, it looks like that is what is happening here anyway.  Something apparently is timing out where WebLogic is concerned!


                              Thanks.

                              • 13. Re: Odd Transactional Exception on WebLogic 9.2
                                Neil C Novice

                                OK, I am a genius for switching the order of replies and totally ruining the hierarchy.  Sorry about that.


                                Anyway, with regard to both Seam and Hibernate controlling transactions via JTA, here is my setup in persistence.xml for a persistence unit called myWebApp:



                                <properties>
                                         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
                                         <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
                                         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
                                         <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>
                                </properties>



                                It may be that the last item in there is the wrong factory.  Would org.hibernate.transaction.JTATransactionFactory be the better choice?


                                As far as Seam, from my components.xml:



                                <persistence:entity-manager-factory name="myWebApp"/>
                                    
                                <persistence:managed-persistence-context name="em"
                                                               auto-create="true" 
                                                    entity-manager-factory="#{myWebApp}"/>



                                Any insight into how my setup is causing WebLogic to be unaware when a transaction completes is greatly appreciated.


                                Thanks.

                                • 14. Re: Odd Transactional Exception on WebLogic 9.2
                                  Neil C Novice

                                  I have tried every other possible value for hibernate.transaction.factory_class besides CMTTransactionFactory, and I don't get that TimedOutException anymore.  Now I get this with JTATransactionfactory (I have tried JDBCTransactionFactory too to no avail):



                                  19 Feb 2008 13:34:50,413: ERROR org.hibernate.util.JDBCExceptionReporter - Transaction BEA1-031263ADA554FEA2ACBA not active anymore. tx status = Marked rollback. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException]


                                  I also found this in the log:



                                  19 Feb 2008 14:03:18,162: WARN  org.hibernate.ejb.Ejb3Configuration - Overriding hibernate.transaction.factory_class is dangerous, this might break the EJB3 specification implementation


                                  Here is another nugget:








                                  19 Feb 2008 14:03:25,653: INFO  org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JTATransactionFactory
                                  19 Feb 2008 14:03:25,663: INFO  org.hibernate.util.NamingHelper - JNDI InitialContext properties:{}
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.transaction.TransactionManagerLookupFactory - instantiating TransactionManagerLookup: org.hibernate.transaction.WeblogicTransactionManagerLookup
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.transaction.TransactionManagerLookupFactory - instantiated TransactionManagerLookup
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.transaction.TransactionManagerLookupFactory - instantiating TransactionManagerLookup: org.hibernate.transaction.WeblogicTransactionManagerLookup
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.transaction.TransactionManagerLookupFactory - instantiated TransactionManagerLookup
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled



                                  and later



                                  19 Feb 2008 14:04:49,405: DEBUG org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
                                  19 Feb 2008 14:04:49,405: DEBUG com.myapp.QueryServiceImpl - Executed query
                                  19 Feb 2008 14:04:49,405: DEBUG com.myapp.QueryServiceImpl - Ending method getCategorieswith 29 categories.
                                  19 Feb 2008 14:04:49,796: DEBUG com.myapp.QueryServiceImpl - Starting method getCategories
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan in cache (from Category)
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan in cache (from Category)
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from TechnicalCategory
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.engine.QueryParameters - named parameters: {}
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
                                  19 Feb 2008 14:04:49,796: DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
                                  19 Feb 2008 14:04:49,876: DEBUG org.hibernate.util.JDBCExceptionReporter - Cannot open connection [???]



                                  I am particularly troubled by these lines:


                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
                                  19 Feb 2008 14:03:25,673: INFO  org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled




                                  Clearly, I need to figure out how transactions and/or sessions get closed.  This is rapidly becoming an urgent need.  I appreciate any insight into this issue as soon as possible.


                                  Thanks.