Forums Register Login

question about jndi

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
Your deployment descriptor needs to have an <env-entry> if you want to lookup using java:comp/env
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
He's my best friend. Not yours. Mine. You can have this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 594 times.
Similar Threads
IntialContext lookup vs EJBContext lookup
Datasource JNDI Lookup in WSAD from standalone app
InitialContext lookup
Problem with Local home interfce accessing in EJB.....
How to deploy a Simple EJB application?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:43:21.