This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

EJB and Sun One Application server

Balaji Thirnrayan
Greenhorn

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
terBean
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:137)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:46)
Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:108)
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,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
 
 
subject: EJB and Sun One Application server
 
Similar Threads
Output from Sun's J2EE Tutorial
ejb hanging
Getting Class cast exception while Lookup EJB2.1 session bean using JNDI name in WAS6.1
How to run the ConverterClient app?
Advice Client problem