• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

EJB and Sun One Application server

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}
}
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic