Re: client managed distributed transactions
Hi David, thanks again for your reply, I've been trying other approaches to this problem lately, the current one is using Spring's JMS remoting with ActiveMQ, Jencks and Geronimo. The JMS services are working fine (as I tested them without any transactional configuration), and I believe the server-side transactional conf might be ok as when I start the server process I can see the queue created in the activemq console and process' log displays: May 29, 2009 2:20:23 PM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager INFO: Using JTA UserTransaction: org.apache.geronimo.transaction.context.geronimotransactionmana...@56c69c May 29, 2009 2:20:23 PM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager INFO: Using JTA TransactionManager: org.apache.geronimo.transaction.context.geronimotransactionmana...@56c69c The problem is that the client halts when it executes the remote call (the process doesn't end or break, just sits there waiting) [this call works correctly with no transactional configuration]. I'm attaching both server and client spring configuration files. http://www.nabble.com/file/p23786932/sample-jms.spring.xml sample-jms.spring.xml http://www.nabble.com/file/p23786932/sample-jms-client.spring.xml sample-jms-client.spring.xml I'm not particularly happy with the client conf as I just copied the server conf and trimmed down the beans I thought weren't needed there, could you please let me know if you see any problems with any of the conf files? Thanks! Diego -- View this message in context: http://www.nabble.com/client-managed-distributed-transactions-tp23455243s134p23786932.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: client managed distributed transactions
through the j2ca work manager stuff, we don't have a full distributed transaction implementation. Be sure you understand the difference between 2-phase multi-resource xa transactions that occur entirely in one vm (at least all the XAResource implementations are in the same vm) and a true distributed transaction in which XAResources are present in several vms; in a typical xa implementation of a distributed tx system you'll have at least two app server instances, one server will control the tx, and all the other servers will be represented as XAResources to the controlling server. So far I've never found anyone who thinks using distributed transactions in a production system is plausible if there is any kind of load involved. This has driven our lack of implementation. I've managed to configure distributed transactions in the past using Jencks and the Geronimo TM but for local datasources (1 mysql db and 1 jackrabbit repository), this configuration required the use of a UserTransaction object, I used spring's jndi mock functionality as I wasn't using a j2ee server. ??? Where did the UserTransaction come from I'm trying to replicate this conf on my current app but my problem is that I can't get a hold of the remote UserTransaction object via jndi. This is how I'm trying to retrieve it: Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory"); properties.put("java.naming.provider.url", "ejbd://localhost: 4201"); Context context = new InitialContext(properties); context.lookup("java:comp/UserTransaction"); I'm getting this exception: Exception in thread "main" javax.naming.NameNotFoundException: comp/ UserTransaction does not exist in the system. Check that the app was successfully deployed. at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java: 277) at javax.naming.InitialContext.lookup(InitialContext.java:351) I don't understand what you want to use the UserTransaction for. To control the entire jta tx or to control the ejb's participation in the tx? If the latter, even if this appeared to work, it wouldn't give you a transaction. UserTransaction doesn't support the 2 phase commit process you need for a multi-resource transaction. IIRC spring doesn't make much effort to point this out. If I go to the Geronimo console and look for UserTransaction using the JNDI Viewer I see that there is an user transaction object under the name java:comp/UserTransaction, so I'm guessing I'm using the correct jndi name on my code. Plus the app successfully retrieves the ejb proxies so I know the jndi service is up and running. How can I retrieve the user transaction then? If there's a reason why the user transaction is not provided for remote clients then does anybody knows of an alternative strategy to do client-managed transactions or any other kind of distributed transactions strategy that allows me to keep track of my local db changes as well the ejbs on the same transaction? If the ejbs are on a different vm than your spring program I'd advise you to rethink your architecture. If you really need them on different machines make the communication asynchronous using jms. thanks david jencks Thanks! - Diego M. -- View this message in context: http://www.nabble.com/client-managed-distributed-transactions-tp23455243s134p23511296.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: client managed distributed transactions
mp/ >> UserTransaction does not exist in the system. Check that the app >> was successfully deployed. >> at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277) >> at javax.naming.InitialContext.lookup(InitialContext.java:351) > > > I don't understand what you want to use the UserTransaction for. To > control the entire jta tx or to control the ejb's participation in the > tx? > > If the latter, even if this appeared to work, it wouldn't give you a > transaction. UserTransaction doesn't support the 2 phase commit > process you need for a multi-resource transaction. IIRC spring > doesn't make much effort to point this out. > >> >> >> >> If I go to the Geronimo console and look for UserTransaction using >> the JNDI Viewer I see that there is an user transaction object under >> the name java:comp/UserTransaction, so I'm guessing I'm using the >> correct jndi name on my code. Plus the app successfully retrieves >> the ejb proxies so I know the jndi service is up and running. >> >> How can I retrieve the user transaction then? If there's a reason >> why the user transaction is not provided for remote clients then >> does anybody knows of an alternative strategy to do client-managed >> transactions or any other kind of distributed transactions strategy >> that allows me to keep track of my local db changes as well the ejbs >> on the same transaction? > > If the ejbs are on a different vm than your spring program I'd advise > you to rethink your architecture. If you really need them on > different machines make the communication asynchronous using jms. > > thanks > david jencks > >> >> >> Thanks! >> - Diego M. > > > -- View this message in context: http://www.nabble.com/client-managed-distributed-transactions-tp23455243s134p23511296.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: client managed distributed transactions
On May 8, 2009, at 4:20 PM, Diego Munguia wrote: Hi, I have a spring-based application that connects to a local database and to a set of remote EJBs that are deployed on a Geronimo 2.1.4 server. I'm trying to configure a transaction manager that handles distributed transactions, because on a single service method I may have calls to the local db and to one or more EJBs (stateless session beans). I don't understand your configuration. Is the spring app running in the same geronimo 2.1.4 instance as the ejbs? If so I suspect you don't need to do anything so long as your ejbs are not configured to start new txs. You might possibly need to use a local ejb interface, but I doubt it. If your spring app is running in a different jvm than geronimo, you will have to do some serious coding to get this to work. Although geronimo does support importing transactions through the j2ca work manager stuff, we don't have a full distributed transaction implementation. Be sure you understand the difference between 2-phase multi-resource xa transactions that occur entirely in one vm (at least all the XAResource implementations are in the same vm) and a true distributed transaction in which XAResources are present in several vms; in a typical xa implementation of a distributed tx system you'll have at least two app server instances, one server will control the tx, and all the other servers will be represented as XAResources to the controlling server. So far I've never found anyone who thinks using distributed transactions in a production system is plausible if there is any kind of load involved. This has driven our lack of implementation. I've managed to configure distributed transactions in the past using Jencks and the Geronimo TM but for local datasources (1 mysql db and 1 jackrabbit repository), this configuration required the use of a UserTransaction object, I used spring's jndi mock functionality as I wasn't using a j2ee server. ??? Where did the UserTransaction come from I'm trying to replicate this conf on my current app but my problem is that I can't get a hold of the remote UserTransaction object via jndi. This is how I'm trying to retrieve it: Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory"); properties.put("java.naming.provider.url", "ejbd://localhost: 4201"); Context context = new InitialContext(properties); context.lookup("java:comp/UserTransaction"); I'm getting this exception: Exception in thread "main" javax.naming.NameNotFoundException: comp/ UserTransaction does not exist in the system. Check that the app was successfully deployed. at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277) at javax.naming.InitialContext.lookup(InitialContext.java:351) I don't understand what you want to use the UserTransaction for. To control the entire jta tx or to control the ejb's participation in the tx? If the latter, even if this appeared to work, it wouldn't give you a transaction. UserTransaction doesn't support the 2 phase commit process you need for a multi-resource transaction. IIRC spring doesn't make much effort to point this out. If I go to the Geronimo console and look for UserTransaction using the JNDI Viewer I see that there is an user transaction object under the name java:comp/UserTransaction, so I'm guessing I'm using the correct jndi name on my code. Plus the app successfully retrieves the ejb proxies so I know the jndi service is up and running. How can I retrieve the user transaction then? If there's a reason why the user transaction is not provided for remote clients then does anybody knows of an alternative strategy to do client-managed transactions or any other kind of distributed transactions strategy that allows me to keep track of my local db changes as well the ejbs on the same transaction? If the ejbs are on a different vm than your spring program I'd advise you to rethink your architecture. If you really need them on different machines make the communication asynchronous using jms. thanks david jencks Thanks! - Diego M.
client managed distributed transactions
Hi, I have a spring-based application that connects to a local database and to a set of remote EJBs that are deployed on a Geronimo 2.1.4 server. I'm trying to configure a transaction manager that handles distributed transactions, because on a single service method I may have calls to the local db and to one or more EJBs (stateless session beans). I've managed to configure distributed transactions in the past using Jencks and the Geronimo TM but for local datasources (1 mysql db and 1 jackrabbit repository), this configuration required the use of a UserTransaction object, I used spring's jndi mock functionality as I wasn't using a j2ee server. I'm trying to replicate this conf on my current app but my problem is that I can't get a hold of the remote UserTransaction object via jndi. This is how I'm trying to retrieve it: Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory"); properties.put("java.naming.provider.url", "ejbd://localhost:4201"); Context context = new InitialContext(properties); context.lookup("java:comp/UserTransaction"); I'm getting this exception: Exception in thread "main" javax.naming.NameNotFoundException: comp/UserTransaction does not exist in the system. Check that the app was successfully deployed. at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277) at javax.naming.InitialContext.lookup(InitialContext.java:351) If I go to the Geronimo console and look for UserTransaction using the JNDI Viewer I see that there is an user transaction object under the name java:comp/UserTransaction, so I'm guessing I'm using the correct jndi name on my code. Plus the app successfully retrieves the ejb proxies so I know the jndi service is up and running. How can I retrieve the user transaction then? If there's a reason why the user transaction is not provided for remote clients then does anybody knows of an alternative strategy to do client-managed transactions or any other kind of distributed transactions strategy that allows me to keep track of my local db changes as well the ejbs on the same transaction? Thanks! - Diego M.