aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB and Sun One Application server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB and Sun One Application server" Watch "EJB and Sun One Application server" New topic

EJB and Sun One Application server

Balaji Thirnrayan

Joined: Nov 13, 2003
Posts: 8
I am trying to run the simple EJB given in J2EE tutorials on Sun 's application server.
I am getting following error,
javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/Conver
at javax.naming.InitialContext.lookup(
at ConverterClient.main(
Caused by: java.lang.NullPointerException
Please let me know what am I missing here, this is my client code. ( The server is rnning and the EJB is deployed properly)
public static void main(String[] args) {
try {
Hashtable env = new Hashtable();
env.put (Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:8080");
env.put(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming" );
Context initial = new InitialContext(env);
Context myEnv = (Context) initial.lookup("java:comp/env");
Object objref = initial.lookup("ejb/ConverterBean");
ConverterHome home = (ConverterHome) PortableRemoteObject.narrow(objref,
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);
amount = currencyConverter.yenToEuro(param);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
It is sorta covered in the JavaRanch Style Guide.
subject: EJB and Sun One Application server
It's not a secret anymore!