I am using jboss 3.2.5.when i am trying to invoke the bussiness method defined in the ejb from a standalone application using javax.transaction.UserTransaction, i am getting the following exception:
public static void main(String[] args) { Hashtable ht=new Hashtable();
try { ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); System.out.println("hello"); ht.put(Context.PROVIDER_URL,"jnp://localhost:8080:1099"); System.out.println("hello"); ht.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces"); System.out.println("hello"); Context ic=new InitialContext(ht); cmt.CMTransHome home =(cmt.CMTransHome)ic.lookup("cmt.CMTransHome"); cmt.CMTransRemote h = home.create(); javax.transaction.UserTransaction ut = (javax.transaction.UserTransaction)ic.lookup("UserTransaction"); System.out.println("Transaction object = "+ ut.getClass()); if (ut == null) System.out.println("ut is null"); else System.out.println("ut is not null");
ut.begin(); h.PerformSomeDBOperation(1000); ut.commit(); //un comment below line and check !!! // ut.rollback(); }catch(Exception e){ System.out.println(e);} }
}
please suggest me a solution on how to resolve this issue.where exactly we can find or configure the jndi name for javax.transaction.UserTransaction.