RequiresNew trans. attribute doesn't create trans
jmntn2000 Dec 10, 2002 8:15 AMHi,
I am having trouble with container managed transactions. I have the following beans.
MDB TestPrintBean
CMP BatchBean
CMP ClaimBean
From the client I send a message to the queue the MDB is configured to listen to. The onMessage method has a transaction attribute of RequresNew. The methods in the Batch and Claim that get called have Mandatory. Jboss throws an exception when the BatchBean methods get called saying that a transaction is Mandatory??? I thought the RequresNew on the onMessage should have started a transaction? Here is the relevant sections of the ejb-jar etc.
ejb-jar:
<message-driven>
<ejb-name>TestPrintBean</ejb-name>
<ejb-class>srripa.ejb.mdb.TestPrintBean</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
-
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
</message-driven>
<container-transaction>
-
<ejb-name>BatchBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>getClaims</method-name>
<method-params>
</method-params>
<trans-attribute>Mandatory</trans-attribute>
</container-transaction>
<container-transaction>
-
<ejb-name>TestPrintBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>onMessage</method-name>
-
<method-params>
<method-param>javax.jms.Message</method-param>
</method-params>
<trans-attribute>Required ( I have also tried RequiresNew here)</trans-attribute>
</container-transaction>
Here is the exception from the console:
javax.ejb.TransactionRequiredLocalException: Transaction Required
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:305)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
01)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:206)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:154)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:481)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalPro
xyFactory.java:351)
at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
at $Proxy597.getClaims(Unknown Source)
at srripa.ejb.mdb.TestPrintBean.onMessage(TestPrintBean.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(Mess
ageDrivenContainer.java:394)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(Message
DrivenInstanceInterceptor.java:88)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:108)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:210)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
01)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityIn
terceptor.java:100)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:206)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:154)
at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.ja
va:311)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvo
ker.java:697)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onM
essage(JMSContainerInvoker.java:985)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:24
1)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMess
ageConsumer.java:601)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:41
5)
at org.jboss.mq.SpySession.run(SpySession.java:293)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
utor.java:642)
at java.lang.Thread.run(Thread.java:536)