We use Websphere 6.0.
I have a web project and an ejb project. when looking up a local ejb through a reference in web.xml in the web project everything works fine.
but if I try to lookup a local ejb stub in a thread that is created at the startup of a servlet I get a :
"Name comp/env/ejb not found in context "java:"." , NameNotFoundException.
When I create a Thread in the init() method of a servlet, within that thread's code I'm still in the web container/JVM, right ? or has it the same effect as if I'd code in a standalone java application ?
if the latter is true, would it be appropriate to create a stub in the init() method of the servlet and pass it to the thread after its creation ? I mean is it ok to cache a local ejb reference / stub ? Are there any known side effects ?
if not what would be a workaround to the NameNotFoundException ?
(i tried to lookup the local ejb with "local:" at the beginning of the jndi name and succeeded, but that's something Websphere uses internal and not thought of public use)
Randy Schnier wrote in a post here :
"The local home
is bound into an internal namespace within the server and should be
accessed via an ejb-local-ref defined in the calling component (which
will be bound by the container into the calling component's
java:comp/env component-specific namespace)."
but how can I access the (Web) component-specific namespace inside a subclass of java.lang.Thread ?
Thanks in advance.
Pinned topic Looking up local ejb in custom thread..
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2008-12-17T16:36:35Z at 2008-12-17T16:36:35Z by SystemAdmin