Newbie Question: JBossTS Setup
antonyb Sep 5, 2007 8:32 AMHi,
I'm somewhat new to JBossTS and am having a few problems getting started. I wonder if someone could point me in the right direction :)
I'm trying to do something not dissimilar to whats being discussed in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117232 thread: my exact scenario is that I have a standalone Java App that connects to a single database via JDBC. Currently I am therefore able to use database-level transactions for all my transactionality. However, my next step in development is to allow multiple instances of the app to run, connected to the same database, in order to be able to load-balance across them. I'm therefore trying to setup a JTS that each instance can connect to in order to continue work within a shared transaction (i.e. instance 1 starts the transaction, instance 2 does some work, instance 3 commits the transaction).
However, I'm getting stuck very early on :) I've set up one server on which I've installed the full JTS package - I'm running it stand-alone, outside of an app server. I've installed the TransactionServer as a service and started it up. Looking at the logs, it seems that jacorb is up and running, with the transaction-server-service.log reporting that:
17:03:16 | [jacorb.poa] INFO : Using server ID (873949937) for transient POA
17:03:16 | [jacorb.orb.singleton] INFO : created ORBSingleton
17:03:16 | [jacorb.orb.giop] INFO : ClientConnectionManager: created new ClientGIOPConnection to 192.168.1.72:1616 (30d082)
17:03:16 | **checking 0
17:03:16 | **registering**
17:03:16 | Ready
17:03:16 | [jacorb.orb] INFO : ORB run
and the transaction-server.log reporting:
17:03:16,207 [Thread-0] INFO com.arjuna.ats.arjuna.logging.arjLoggerI18N - [com.arjuna.ats.arjuna.recovery.TransactionStatusManager_3] - TransactionStatusManager started on port 1617 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
I'm thinking that I now want to write my app to call TransactionFactory.create() in order to get hold of a Control object - but its the step in the middle where I get lost: where do I lookup the TransactionFactory? I tried:
Hashtable env = new Hashtable ();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "corbaname::iiop://192.168.1.72:1616/");
InitialContext ictx = new InitialContext(env);
NamingEnumeration ctxlist = ictx.list("");
while (ctxlist.hasMore())
{
Object o = ctxlist.next();
System.out.prinln("Found: " + o);
}
but this threw an exception, and the transaction-server-service.log showed a:
17:06:35 | [jacorb.orb.iiop] INFO : Opened new server-side TCP/IP transport to 192.168.1.31:4078
17:06:35 | [jacorb.giop.server.l] WARN : Received a request with a non-jacorb object key
17:06:35 | [jacorb.orb.iiop] INFO : Closed server-side transport to 192.168.1.31:4078
So, questions:
1. Do I need any special configuration in jboss-jts-properties.xml for this setup? I've setup the ObjectStore, set the jtaTMImplementation and jtaUTImplementation to jts - thats it.
2. How do I specify on which port the jacorb created by the Transaction Server listens on? It changes each time?
3. Should I be expecting to be able to look stuff up directly on that ORB?
Any pointers, help most appreciated!
Thanks
Ant.