6 Replies Latest reply on Dec 9, 2008 9:14 AM by weinfie

    javax.transaction.NotSupportedException trying to begin User

    weinfie

      - Need global trx in MDB using MQSeries and DB2
      - using db2-jcc-xa-ds.xml
      - after lookup
      utx = (UserTransaction) iniCtx.lookup("UserTransaction");
      and attempting to begin global trx
      utx.begin();

      I get the javax.transaction.NotSupportedException

      I need the ability to utx.commit() or utx.rollback().

      Any other configuration required, i.e. JbossTS, and/or XA switch files?

        • 1. Re: javax.transaction.NotSupportedException trying to begin
          jhalliday

          Post the full log, but the chances are you already have a tx on the thread and it's preventing you nesting.

          • 2. Re: javax.transaction.NotSupportedException trying to begin
            weinfie

            Here is what I am attempting to do:
            1. Resource coordinator begins global trx (utx.begin() )
            2. Resource manager 1 (MQSeries) does work
            3. Resource manager 2 (DB2) does more work
            4. If all resmgrs successful, commit trx, else rollback trx.

            11:30:31,625 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.2.3.GA/server/default/deploy/EJBApp1.ear
            11:30:49,312 INFO [STDOUT] SimpleMDB.ctor, this=29242476
            11:30:49,312 INFO [STDOUT] SimpleMDB.setMessageDrivenContext, this=29242476
            11:30:49,312 INFO [STDOUT] SimpleMDB.ejbCreate, this=29242476
            11:30:49,312 INFO [STDOUT] Begin transaction
            11:30:49,312 INFO [STDOUT] caught NotSupportedException: javax.transaction.NotSupportedException
            11:30:49,312 INFO [STDOUT] SimpleMDB.onMessage, this=29242476
            11:30:49,312 INFO [STDOUT] Message received = struct EmailBody {
            char Instruction[50]; /* instruction */
            char URL[50]; /* URL */
            char Disclaimer[50]; /* email disclaimer */
            char Reserved1[15]; /* Reserved */
            }; processed by: 29242476
            11:30:49,406 INFO [STDOUT] *** Running query ***
            11:30:49,468 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_34] - End called on already committed atomic action -3f57fefd:841:493d40d4:b7
            11:30:49,468 ERROR [STDERR] WMQ Resource Adapter warning: MQJCA4004:Message delivery to an MDB failed. See the linked exception for details.

            • 3. Re: javax.transaction.NotSupportedException trying to begin
              jhalliday

              Please stop trying to take shortcuts, it just slows things down in the long run. The information you have provided does not contain what I need to know. You know what I'm trying to find out: if there is already a tx in progress on the thread. Is that information contained in the log snipped you posted? I think not. I need debug level logging from the transaction manager, which would show the earlier tx starting but not ending, or the stack trace from the exception, the line numbers from which would show which check in begin is throwing the exception, if indeed it's from begin and not something that happens after that.

              You get better answers if you know how to ask the questions: http://www.jboss.org/community/docs/DOC-9851

              • 4. Re: javax.transaction.NotSupportedException trying to begin
                weinfie

                If I knew you needed debug level logging, I would have turned it on. You needn't be rude. It really doesn't help. After turning on debug in log4j.xml, after the verbose startup, I get basically the same info. Obviously I can't post the entire server log here.

                At the point that the MDB is started, I get:
                2008-12-08 12:46:38,015 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
                2008-12-08 12:46:38,031 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 25s:110ms
                2008-12-08 12:46:38,046 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
                2008-12-08 12:46:38,046 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
                2008-12-08 12:46:48,046 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - second pass <Mon, 8 Dec 2008 12:46:48>
                2008-12-08 12:46:48,046 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] AtomicActionRecoveryModule: Second pass
                2008-12-08 12:46:48,046 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
                2008-12-08 12:46:48,062 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.secondpass] Local XARecoveryModule - second pass
                2008-12-08 12:47:06,437 INFO [STDOUT] SimpleMDB.ctor, this=3888519
                2008-12-08 12:47:06,453 INFO [STDOUT] SimpleMDB.setMessageDrivenContext, this=3888519
                2008-12-08 12:47:06,453 INFO [STDOUT] SimpleMDB.ejbCreate, this=3888519
                2008-12-08 12:47:06,468 INFO [STDOUT] Begin transaction
                2008-12-08 12:47:06,468 INFO [STDOUT] caught NotSupportedException: javax.transaction.NotSupportedException
                2008-12-08 12:47:06,468 INFO [STDOUT] SimpleMDB.onMessage, this=3888519
                2008-12-08 12:47:06,468 INFO [STDOUT] Message received = This is a sample message to be read by a MDB. processed by: 3888519
                2008-12-08 12:47:06,468 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 9223372036854775807
                2008-12-08 12:47:06,468 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: about to notify thread: old next: 1228758876468, new next: 1228758876468
                2008-12-08 12:47:06,468 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
                2008-12-08 12:47:07,125 INFO [STDOUT] *** Running query ***
                2008-12-08 12:47:07,687 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_34] - End called on already committed atomic action -3f57fefd:b62:493d5d67:31
                2008-12-08 12:47:07,687 ERROR [STDERR] WMQ Resource Adapter warning: MQJCA4004:Message delivery to an MDB failed. See the linked exception for details.
                2008-12-08 12:47:59,250 INFO [org.jboss.system.server.Server] Runtime shutdown hook called, forceHalt: true
                2008-12-08 12:47:59,250 INFO [org.jboss.system.server.Server] JBoss SHUTDOWN: Undeploying all packages

                I am using a JCA adapter supplied by IBM: wmq.jmsra.rar, and a JNDI file wmq.jmsra-ds.xml:

                <?xml version="1.0" encoding="UTF-8"?>
                <!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Stephen A. Weinfield (Encode Inc.) -->
                <connection-factories>
                <!-- JCA Connection factory definitions -->
                <tx-connection-factory>
                <jndi-name>IVTCF</jndi-name>
                <xa-transaction/>
                <rar-name>wmq.jmsra.rar</rar-name>
                <track-connection-by-tx/>
                <application-managed-security/>
                <connection-definition>javax.jms.ConnectionFactory</connection-definition>
                <config-property name="queueManager" type="java.lang.String">WBRK61_DEFAULT_QUEUE_MANAGER</config-property>
                <config-property name="transportType" type="java.lang.String">BINDINGS</config-property>
                </tx-connection-factory>
                <tx-connection-factory>
                <jndi-name>IVRCF</jndi-name>
                <xa-transaction/>
                <rar-name>wmq.jmsra.rar</rar-name>
                <track-connection-by-tx/>
                <application-managed-security/>
                <connection-definition>javax.jms.ConnectionFactory</connection-definition>
                <config-property name="queueManager" type="java.lang.String">WBRK61_DEFAULT_QUEUE_MANAGER</config-property>
                <config-property name="transportType" type="java.lang.String">BINDINGS</config-property>
                </tx-connection-factory>
                <tx-connection-factory>
                <jndi-name>ESF_CF</jndi-name>
                <xa-transaction/>
                <rar-name>wmq.jmsra.rar</rar-name>
                <track-connection-by-tx/>
                <application-managed-security/>
                <connection-definition>javax.jms.ConnectionFactory</connection-definition>
                <config-property name="queueManager" type="java.lang.String">WBRK61_DEFAULT_QUEUE_MANAGER</config-property>
                <config-property name="transportType" type="java.lang.String">BINDINGS</config-property>
                </tx-connection-factory>
                <!-- mbeans defining JCA administered objects -->

                IVTQueue
                <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
                javax.jms.Queue

                <!-- baseQueueManagerName -->
                baseQueueName=SYSTEM.DEFAULT.LOCAL.QUEUE



                IVRQueue
                <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
                javax.jms.Queue

                <!-- baseQueueManagerName -->
                baseQueueName=IVRQUEUE



                esfSubmitQ
                <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
                javax.jms.Queue

                baseQueueName=TTAC.ESF.FORM.SUBMIT


                </connection-factories>

                The EJB is bundled with ejb-jar.xml:

                <?xml version="1.0"?>
                <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
                <enterprise-beans>
                <message-driven>
                SimpleMDB
                <display-name>SimpleMDB</display-name>
                <ejb-name>SimpleMDB</ejb-name>
                <ejb-class>SimpleMDB</ejb-class>
                <transaction-type>Container</transaction-type>
                <!-- <message-selector/> -->
                <message-driven-destination>
                <destination-type>javax.jms.Queue</destination-type>
                </message-driven-destination>
                <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
                <activation-config>
                <activation-config-property>
                <activation-config-property-name>destination</activation-config-property-name>
                <activation-config-property-value>TTAC.ESF.FORM.UPDATE</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                <activation-config-property-name>destinationType</activation-config-property-name>
                <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                <activation-config-property-name>useJNDI</activation-config-property-name>
                <activation-config-property-value>false</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                <activation-config-property-name>queueManager</activation-config-property-name>
                <!-- using default queue manager -->
                <activation-config-property-value></activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                <activation-config-property-name>transportType</activation-config-property-name>
                <activation-config-property-value>BINDINGS</activation-config-property-value>
                </activation-config-property>
                </activation-config>
                </message-driven>
                </enterprise-beans>

                <assembly-descriptor>
                <container-transaction>

                <ejb-name>SimpleMDB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Required</trans-attribute>
                </container-transaction>
                </assembly-descriptor>
                </ejb-jar>

                There is an XA DD for DB2 called db2-jcc-xa-ds.xml which contains:

                <?xml version="1.0" encoding="UTF-8"?>


                <!--
                IBM DB2 XA driver
                db2jcc.jar
                -->

                <xa-datasource>
                <jndi-name>DB2DS</jndi-name>

                <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
                <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
                <xa-datasource-property name="PortNumber">50000</xa-datasource-property>
                <xa-datasource-property name="DatabaseName">SAMPLE</xa-datasource-property>
                <xa-datasource-property name="DriverType">4</xa-datasource-property>
                <xa-datasource-property name="User">SAW</xa-datasource-property>
                <xa-datasource-property name="Password">thePassword</xa-datasource-property>

                <!-- Note, as opposed to the Type2 driver, DB2 Type 4 requires the PortNumber. By default this is 50000-->

                <!-- Must be set if using multiple DB2 XA resources in same transaction -->

                <track-connection-by-tx></track-connection-by-tx>
                <isSameRM-override-value>false</isSameRM-override-value>

                <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->

                <type-mapping>DB2</type-mapping>


                </xa-datasource>


                • 5. Re: javax.transaction.NotSupportedException trying to begin
                  marklittle

                  How come you failed to mention:


                  11:30:49,468 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_34] - End called on already committed atomic action -3f57fefd:841:493d40d4:b7


                  in your initial posting? Did you not think that was pertinent to the discussion? In general, if you see warnings or errors they are probably worth taking note of.

                  • 6. Re: javax.transaction.NotSupportedException trying to begin
                    weinfie

                    The "End call on already committed atomic action" ERROR is symptomatic of the same problem, and is produced when the transaction attempts a utx.commit(). The real problem is that the NotSupported exception is thrown with the utx.begin().

                    My guess is that, because this is an MDB EJB, it is container managed and therefore doesn't permit the explicit utx.begin() with commits and rollbacks.

                    I am using JB4.2.3-GA without JBossTS.