Re: Re: Distribued JOTM transaction between 2 jonasses

Son Tung Nguyen <[email protected]> Thu, 14 Apr 2011 11:47:19 +0200
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
Hi Benoit,

"[ ... ] I'm not sure where is located this code (likely WebAp2)"

Yes, I use spring JMS container listener (MDP) in WebAp2, and the
transactional annotation of onMessage method is
@Transactional(propagation=Propagation.MANDATORY).


"If T2 rollbacks, it doesn't cause a rollback for T1 !"

I thought that JOTM is an implementation of JTA technologies, so it supports
XA transactions. I would expect that T1 and T2 have (participated in to) the
same global transaction (XA) that's driven by JOTM between Jonasses ...

If i's so, JOTM implementation is just for local use of a jonas ? How can i
configure jonasses to have transactions that across 2 servers (between
Webaps)  for carying out integrity of informations ?

Regards,

Sontung

2011/4/14 Benoit Pelletier <[email protected]>

>  Hi Son Tung,
>
> If i understood correctly, the behavior is normal as there're two different
> transactions when the requests goes across queues or topics :
> *Transaction T1)* is about the request processing in WebAp1. This
> transaction puts information in db and creates a message in the joram2's
> queue. This transactions is finishing at this point.
> *Transaction T2) *is about the message processing (onMethod()). I'm not
> sure where is located this code (likely WebAp2).
>
> If T2 rollbacks, it doesn't cause a rollback for T1 !
>
> Regards
>
>  Hi,
>
>  I'm configuring 2 Jonas (with 2 webapps) and I would like to use JOTM
> implemetation for distribued transactions between webapps (or servers). I
> did ask for configurations of servers in my previous thread (at
> http://jonas.ow2.org/wws/arc/jonas/2011-03/msg00062.html).
>
>  Let say, Jonas 1 -> alias *S1*, and Jonas 2 -> alias *S2*
>
>  *S1* have *Webap1*
> *S2* have *Webap2* and *joram2*
> *
> *
> *The senario is:**
> *
>
>  *Webap1* received a request, create a DTO, trace informations in
> database(DB), and send it in queue of *joram2* (*S2*) . in onMessage
> method call, it has to do something. If last action failed, it has to
> rollback all modifications done in previous action (tracing in DB on *
> S1::Webap1*).
>
>
>
>  For testing, on onMessage method call, i throw systematically a
> RuntimeException().
>
> When i have configurations (of jonas.properties) like :
>
>  *S1:*
>
>  # Set the Transaction Manager launching mode.
> # If set to 'true', TM is remote: TM must be already launched in an other
> JVM.
> # If set to 'false', TM is local: TM is going to run into the same JVM
> # than the jonas Server.
> jonas.service.jtm.remote  *false*
>
>  *S2:*
> [....]
> jonas.service.jtm.remote  *false*
>
>  The rollingback doesn't seem to work; informations saved in database (on
> *Webap1* - *S1*) was not rollbacked.
>
>  And when i have configurations like:
>
>  *S1:*
>
>  # Set the Transaction Manager launching mode.
> # If set to 'true', TM is remote: TM must be already launched in an other
> JVM.
> # If set to 'false', TM is local: TM is going to run into the same JVM
> # than the jonas Server.
> jonas.service.jtm.remote  *false*
>
>  *S2:*
> [....]
> jonas.service.jtm.remote  *true*
> *
> *
> I get this trace :*
>
> *
> 2011-04-14 10:24:56,371 : JonasSecurityServiceImpl.__doStart : Security
> Service started
> 2011-04-14 10:24:56,387 : JOnASWorkCleanerService.__doStart : WorkCleaner
> Service started.
> 2011-04-14 10:24:56,464 : JOTMTransactionService.__doStart : Cannot get TM
> factory - retrying...
> 2011-04-14 10:24:58,465 : JOTMTransactionService.__doStart : Cannot get TM
> factory - retrying...
> 2011-04-14 10:25:02,466 : JOTMTransactionService.__doStart : Cannot get TM
> factory - retrying...
> 2011-04-14 10:25:08,467 : JOTMTransactionService.__doStart : Cannot get TM
> factory - retrying...
> 2011-04-14 10:25:16,131 : ServiceManagerImpl.__checkServiceStates : JOnAS
> server cannot reach the RUNNING state
> 2011-04-14 10:25:16,131 : ServiceManagerImpl.__checkServiceStates : Service
> 'jtm' is not running
> 2011-04-14 10:25:16,132 : ServiceManagerImpl.__checkServiceStates : Service
> 'dbm' is not running
> 2011-04-14 10:25:16,132 : ServiceManagerImpl.__checkServiceStates : Service
> 'resource' is not running
> 2011-04-14 10:25:16,133 : ServiceManagerImpl.__checkServiceStates : Service
> 'web' is not running
> 2011-04-14 10:25:16,133 : ServiceManagerImpl.__checkServiceStates : Service
> 'depmonitor' is not running
> 2011-04-14 10:25:16,133 : ServiceManagerImpl.__checkServiceStates : Service
> 'wm' is not running
> 2011-04-14 10:25:16,134 : ServiceManagerImpl.__checkServiceStates : Please
> check the JOnAS server configuration.
> 2011-04-14 10:25:16,468 : JOTMTransactionService.__doStart : Cannot get TM
> factory - retrying...
> 2011-04-14 10:25:26,470 : JOTMTransactionService.__doStart :
> TransactionService: Cannot get TM factory:
> javax.naming.NamingException: TransactionService: Cannot get TM factory
> 2011-04-14 10:25:26,471 : LoggerService.log : [ERROR]
> org.ow2.jonas.tm.jotm.JOTMTransactionService :
> [org.ow2.jonas.tm.jotm.JOTMTransactionService.277b9268-66e9-49c4-99b7-544a58f24544]
> The callback method start has thrown an exception : TransactionService:
> Cannot get TM factory: javax.naming.NamingException: TransactionService:
> Cannot get TM factory
> org.ow2.jonas.service.ServiceException : TransactionService: Cannot get TM
> factory: javax.naming.NamingException: TransactionService: Cannot get TM
> factory
>     at
> org.ow2.jonas.tm.jotm.JOTMTransactionService.__doStart(JOTMTransactionService.java:254)
>     at
> org.ow2.jonas.tm.jotm.JOTMTransactionService.doStart(JOTMTransactionService.java)
>     at
> org.ow2.jonas.lib.service.AbsServiceImpl.start(AbsServiceImpl.java:95)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:616)
>     at org.apache.felix.ipojo.util.Callback.call(Callback.java:231)
>     at org.apache.felix.ipojo.util.Callback.call(Callback.java:191)
>     at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
>     at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
>     at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
>     at
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:428)
>     at
> org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:309)
>     at
> org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:155)
>     at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:283)
>     at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:220)
>     at org.apache.felix.ipojo.IPojoFactory.updated(IPojoFactory.java:588)
>     at
> org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1253)
>     at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)
> Caused by: javax.naming.NamingException: TransactionService: Cannot get TM
> factory
>     at
> org.ow2.jonas.tm.jotm.JOTMTransactionService.__doStart(JOTMTransactionService.java:239)
>     ... 19 more
>
> Did i miss something ?
>
> Thank you for your help,
>
>
> Sontung
>
>
>
> --
>
> ----------------------------------------------------------------
> Benoit Pelletierhttp://jonas.ow2.org
> Bull, Architect of an Open World TMhttp://www.bull.com
>
>