my dog learned polymorphism
The moose likes EJB and other Java EE Technologies and the fly likes client-intiated  transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "client-intiated  transactions" Watch "client-intiated  transactions" New topic

client-intiated transactions

siva sankar
Ranch Hand

Joined: Jul 13, 2006
Posts: 68

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:

javax.transaction.SystemException: java.lang.RuntimeException: UT factory lookup failed: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Here is my code

/* Shows how to control transactions from client
Author : Team -J
Version : 1.0 , with this example we set transaction attribute
to mandatory

import cmt.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.*;

public class CMTransClient {

public static void main(String[] args) {
Hashtable ht=new Hashtable();

try {
ht.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
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");
System.out.println("ut is not null");

//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.

Thanks in Advance,
Siva Sankar
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
Is the following line correct?


I believe it should be

siva sankar
Ranch Hand

Joined: Jul 13, 2006
Posts: 68
Hi vinay,

thanks for your reply.I tried by placing the line you suggested.But i am getting the same error.
I agree. Here's the link:
subject: client-intiated transactions
It's not a secret anymore!