Transaction over RMI?

View: New views
1 Messages — Rating Filter:   Alert me  

Transaction over RMI?

by SY-1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all!

I would like to know if transaction works over RMI?  there is my code :

Hashtable ht=new Hashtable();
ht.put("java.naming.factory.initial", "org.jboss.naming.NamingContextFactory");      
ht.put("java.naming.provider.url",  "jnp://localhost:1099/jcrServer");
ht.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
InitialContext initialContext = new InitialContext(ht);

ClientAdapterFactory adapter = new ClientAdapterFactory();
RemoteRepository rr=(RemoteRepository) initialContext.lookup("jnp://localhost:1099/jcrServer");
Repository repository = adapter.getRepository(rr);
Credentials credJBoss = new SimpleCredentials("username","password".toCharArray());
Session s=repository.login(credJBoss);
Node root = s.getRootNode();

UserTransaction utx = (javax.transaction.UserTransaction) initialContext.lookup("java:UserTransaction"); utx.begin();
root.addNode("M5");
s.save();
utx.rollback();
s.logout();

The problem is that neither commit or rollback works ? so i m wondering if RMI support transaction operation? if anyone has an idea it would be great thanks !