ctx = new InitialContext();
What about the Properties Object?
Properties p = new Properties ();
p.put( Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory" );
p.put( Context.PROVIDER_URL,
"t3://localhost:7001" );
ctx = new InitialContext( p );
I copied this code out of OReilly's EJB 3rd ED
page 103.
The following example comes from the J2EE tutorial
public void withdrawCash(double amount) {
UserTransaction ut = context.getUserTransaction();
try {
ut.begin();
updateChecking(amount);
machineBalance -= amount;
insertMachine(machineBalance);
ut.commit();
} catch (Exception ex) {
try {
ut.rollback();
} catch (SystemException syex) {
throw new EJBException
("Rollback failed: " + syex.getMessage());
}
throw new EJBException
("Transaction failed: " + ex.getMessage());
}
}
HTH