0 Replies Latest reply on Apr 19, 2006 5:46 AM by Sebastien Claude

    Transaction not created

    Sebastien Claude Newbie

      Hello,
      I use jboss 3.2.5
      I have create a Queue and MDB.
      This is ejb-jar.xml

       <enterprise-beans>
      
       <message-driven>
       <ejb-name>ReceveurMessageBean</ejb-name>
       <ejb-class>fr.asso.aaa.timmat.mdb.Receveur</ejb-class>
       <transaction-type>Container</transaction-type>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       <subscription-durability>Durable</subscription-durability>
       <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
       </message-driven-destination>
       <resource-ref>
       <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       </message-driven>
      
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>ReceveurMessageBean</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
      
       </enterprise-beans>
      


      and jboss.xml
       <enterprise-beans>
      
       <message-driven>
       <ejb-name>ReceveurMessageBean</ejb-name>
       <configuration-name>Standard Message Driven Bean</configuration-name>
       <destination-jndi-name>queue/exampleQueue</destination-jndi-name>
       <!-- <mdb-user>guest</mdb-user>
       <mdb-passwd>guest</mdb-passwd>
       <mdb-subscription-id>Admin</mdb-subscription-id>-->
       </message-driven>
      
       </enterprise-beans>
      


      The MDB receive messages but if I call setRollbackOnly() in onMessage() method, I have the following exception :
      10:40:14,428 INFO [STDOUT] java.lang.IllegalStateException: setRollbackOnly must only be called in the context of a transaction (EJB 2.0 - 15.5.1)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.MessageDrivenEnterpriseContext$MessageDrivenContextImpl.setRollbackOnly(MessageDrivenEnterpriseContext.java:214)
      10:40:14,428 INFO [STDOUT] at fr.asso.aaa.timmat.mdb.Receveur.onMessage(Receveur.java:83)
      10:40:14,428 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      10:40:14,428 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      10:40:14,428 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      10:40:14,428 INFO [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:458)
      10:40:14,428 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:62)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:282)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:90)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:372)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:723)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:914)
      10:40:14,428 INFO [STDOUT] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1208)
      10:40:14,428 INFO [STDOUT] at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:276)
      10:40:14,428 INFO [STDOUT] at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:871)
      10:40:14,428 INFO [STDOUT] at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
      10:40:14,428 INFO [STDOUT] at org.jboss.mq.SpySession.run(SpySession.java:347)
      10:40:14,428 INFO [STDOUT] at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200)
      10:40:14,428 INFO [STDOUT] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
      10:40:14,428 INFO [STDOUT] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      10:40:14,428 INFO [STDOUT] at java.lang.Thread.run(Unknown Source)
      


      I don't understand why the transaction does not exist ?
      Thanks for your help.