• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about jndi  RSS feed

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i write a "hello" bean,jndi name is also "hello",in my testclient,i specify:
initialContext.lookup("hello")
it works well,if i modify it as:
initialContext.lookup("java:comp/env/hello")
the jbuilder6 throw a "missing node" exception.could you help me?maybe i am
not familiar with jndi.
thank you!
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your deployment descriptor needs to have an <env-entry> if you want to lookup using java:comp/env
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your test client is running within the context of a web application, which is J2EE-based with a web.xml file, then you can use the "java:comp/ejb" context to find the bean. IN other words, lets say you have defined a reference to the ejb in your web.xml like this:
<ejb-ref>
<ejb-ref-name>ejb/hello/</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>HelloHome</home>
<remote>Hello</remote>
</ejb-ref>
...then you can look up the bean using...
initialContext.lookup("java:comp/env/ejb/hello")
You can also find the EJB using the JNDI name alone.
SAF
 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
thanks for all of your helps
if my test program is NOT a web program,how can i invoke the test program from command line?
thank
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!