[jboss-user] [EJB 3.0] - Re: Can't get @TransactionTimeout to work

Pablo Fraga do-not-reply at jboss.com
Thu Sep 23 14:33:21 EDT 2010

Pablo Fraga [http://community.jboss.org/people/pablo.fraga1975] created the discussion

"Re: Can't get @TransactionTimeout to work"

To view the discussion, visit: http://community.jboss.org/message/563409#563409


It doesn't work.

This is mi relevant code.


@Stateful(name = "DiccionarioEJB")
@Remote(value = RemoteEJBService.class)
public class DiccionarioEJB extends AbstractSessionFacade implements
        DiccionarioRemote {

    private static Logger log = Logger.getLogger(DiccionarioEJB.class);

    @Resource(mappedName = "java:/smsds")
    private DataSource dataSource;

    public ResultObtenerDiccionario obtenerDiccionario(AbstractCommand command) {


        try {

            // sleeps 20 seconds


        } catch (Throwable t) {
            System.out.println("SUCCESS! Expected tx timeout error");
            return null;

        return null;


    private void testConnection() {
        Connection conn = null;
        try {
            conn = this.dataSource.getConnection();
            System.out.println("Got connection");
        } catch (Throwable t) {
                    .println("Error while getting connection from tx aware datasource: ");
            throw new RuntimeException(t);
        } finally {
            if (conn != null) {
                try {
                } catch (SQLException e) {
                    System.out.println("Error closing connection "
                            + e.getMessage());


JTA timeout set to 10 seconds

<!-- JBoss Transactions JTA -->
   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
      <attribute name="TransactionTimeout">10</attribute>
      <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute> 


15:18:07,252 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id 7f000101:a89c:4c9b9942:32 invoked while multiple threads active within it.
15:18:07,252 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action 7f000101:a89c:4c9b9942:32 aborting with 1 threads active!
15:19:24,903 INFO  [STDOUT] Error while getting connection from tx aware datasource: 
15:19:25,740 INFO  [STDOUT] SUCCESS! Expected tx timeout error
15:19:26,723 ERROR [STDERR] java.lang.RuntimeException: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 7f000101:a89c:4c9b9942:32 status: ActionStatus.ABORTED >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 7f000101:a89c:4c9b9942:32 status: ActionStatus.ABORTED >)

In my example the global transaction time out was set to 10 seconds, my EJB method is annotated with 500 seconds, the EJB method first testConnection, then sleeps 20 seconds and finally tries to connect again but it fails because the transaccion is not active anymore.

What is wrong?


Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100923/c4885308/attachment-0001.html 

More information about the jboss-user mailing list