3 Replies Latest reply on Sep 30, 2011 7:08 AM by alexland

    JBOSS AS 6 Web Service and Transaction timeout

    alexland

      Hello,

       

      I have a SLSB which is also a Web service:

       

      @Stateless
      @WebService
      public class SyncInfoWS {
      
      ...
      
      }
      

       

       

      I set up transaction timeout to 15 minutes in transaction-jboss-beans.xml in JBOSS AS 6:

       

          <bean name="CoordinatorEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean">
              <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jta:name=CoordinatorEnvironmentBean", exposedInterface=com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBeanMBean.class, registerDirectly=true)</annotation>
      
              <constructor factoryClass="com.arjuna.ats.arjuna.common.arjPropertyManager" factoryMethod="getCoordinatorEnvironmentBean"/>
              <property name="enableStatistics">false</property>
              <property name="defaultTimeout">900</property>
          </bean>
      

       

      But when the WS is invoked before the end the timeout, I got the following exception:

       

       

      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection 
       at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214) [:3.6.0.Final] 
       at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147) [:3.6.0.Final] 
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:255) [:3.6.0.Final] 
       at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:260) [:3.6.0.Final] 
       at com.eggsweb.commons.repository.AbstractRepository.getList(AbstractRepository.java:447) [:] 
       ... 303 more 
       Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection 
       at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) [:3.6.0.Final] 
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) [:3.6.0.Final] 
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [:3.6.0.Final] 
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) [:3.6.0.Final] 
       at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) [:3.6.0.Final] 
       at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) [:3.6.0.Final] 
       at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.doQuery(Loader.java:801) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.doList(Loader.java:2533) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) [:3.6.0.Final] 
       at org.hibernate.loader.Loader.list(Loader.java:2271) [:3.6.0.Final] 
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452) [:3.6.0.Final] 
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) [:3.6.0.Final] 
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [:3.6.0.Final] 
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268) [:3.6.0.Final] 
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [:3.6.0.Final] 
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:246) [:3.6.0.Final] 
       ... 305 more 
       Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff7f000001:126a:4e849ba5:e9702 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff7f000001:126a:4e849ba5:e9702 status: ActionStatus.ABORT_ONLY >) 
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95) [:6.0.0.Final] 
       at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71) [:3.6.0.Final] 
       at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) [:3.6.0.Final] 
       ... 319 more 
       Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffff7f000001:126a:4e849ba5:e9702 status: ActionStatus.ABORT_ONLY > 
       at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:403) [:6.0.0.Final] 
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) [:6.0.0.Final] 
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) [:6.0.0.Final] 
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89) [:6.0.0.Final] 
       ... 321 more
      
      

       

      it seems web service invocation doesn't set up the right transaction timeout.

       

      Thanks in advance for the answer

      Alex

        • 1. Re: Web Service and Transaction timeout
          alexland

          I also tried to put @TransactionTimout:

           

          @Stateless
          @WebService
          @TransactionTimeout(5)
          public class SyncInfoWS {
            ...
          }
          

           

          I tried 5 seconds but the timeout wasn't triggered after 5 seconds

          • 2. Re: JBOSS AS 6 Web Service and Transaction timeout
            jhalliday

            ABORT_ONLY != ABORTED.  It's marked for rollback, not actually rolledback, so it's not a timeout.

            • 3. Re: JBOSS AS 6 Web Service and Transaction timeout
              alexland

              I wonder if it is marked for rollback because of timeout.

               

              I tried to do:

               

              <bean name="CoordinatorEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean">

                      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name=jboss.jta:name=CoordinatorEnvironmentBean, exposedInterface=com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBeanMBean.class, registerDirectly=true)</annotation>

               

               

                      <constructor factoryClass="com.arjuna.ats.arjuna.common.arjPropertyManager" factoryMethod="getCoordinatorEnvironmentBean"/>

                      <property name="enableStatistics">false</property>

                      <property name="defaultTimeout">5</property>

                  </bean>

               

              and I tried to invoke a SLSB method that took longer than 5 seconds to complete, I got the same exception.