aspose file tools*
The moose likes Websphere and the fly likes JNDI reference error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI reference error" Watch "JNDI reference error" New topic
Author

JNDI reference error

ayan sevi
Greenhorn

Joined: Sep 21, 2006
Posts: 21
Hi again,

I've been playing around with this JNDI reference unusual error for about more than a day but can't figured out why this problem occurred.

Here's the problem, when I tried to put the following nodes into my web xml, fortunately, I can access the said resource using java:comp/env reference:

<ejb-ref id="EjbRef_1">
<ejb-ref-name>docsense.AccessControlHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.docsense.core.ejb.AccessControl.AccessControlHome</home>
<remote>com.docsense.core.ejb.AccessControl.AccessControl</remote>
<ejb-link>CoreEJB.jar#AccessControlBean</ejb-link>
</ejb-ref>

corresponding ibm-web-bnd.xmi:

<ejbRefBindings xmi:id="EjbRefBinding_1172001538938" jndiName="ejb/AccessControlBean">
<bindingEjbRef href="WEB-INF/web.xml#EjbRef_1"/>
</ejbRefBindings>

But when I tried to register another reference of another EJB to the same web xml, shown below:

<ejb-ref id="EjbRef_2">
<ejb-ref-name>docsense.ProfileHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.docsense.core.ejb.Profile.ProfileHome</home>
<remote>com.docsense.core.ejb.Profile.Profile</remote>
<ejb-link>CoreEJB.jar#ProfileBean</ejb-link>
</ejb-ref>

corresponding ibm-web-bnd.xmi:

<ejbRefBindings xmi:id="EjbRefBinding_1172069350938" jndiName="ejb/ProfileBean">
<bindingEjbRef href="WEB-INF/web.xml#EjbRef_2"/>
</ejbRefBindings>

Its giving me a javax.naming.NameNotFoundException when I access the second resource, as shown in stack trace:

javax.naming.NameNotFoundException: Context: MND06100738Node01Cell/nodes/MND06100738Node01/servers/server1, name: docsense.ProfileHome: First component in name docsense.ProfileHome not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0]
at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException(CNContextImpl.java:4730)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1907)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1862)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1552)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1354)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.docsense.core.EjbUtil.getEjbHome(EjbUtil.java:111)
at com.docsense.core.mvc.MenuModel.refresh(MenuModel.java:139)
at com.docsense.core.mvc.MenuModel.<init>(MenuModel.java:78)
at com.docsense.core.mvc.Session.<init>(Session.java:57)
at com.docsense.core.mvc.HttpController.createSession(HttpController.java:724)
at com.docsense.core.mvc.HttpController.getSession(HttpController.java:643)
at com.docsense.core.mvc.HttpController.initSession(HttpController.java:553)
at com.docsense.core.mvc.HttpController.doPostAndGet(HttpController.java:279)
at com.docsense.core.mvc.HttpController.doGet(HttpController.java:192)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.SingleThreadModelServlet.service(SingleThreadModelServlet.java:127)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3107)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
Caused by:
org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:543)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2215)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:536)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4351)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1901)
... 43 more

Here is an excerpt of namespace dump for reference:

....
24 (top)/nodes/MND06100738Node01/servers/server1/ejb/ProfileBean
25 (top)/nodes/MND06100738Node01/servers/server1/ejb/ivtEJBObject
26 (top)/nodes/MND06100738Node01/servers/server1/ejb/UserModelBean
27 (top)/nodes/MND06100738Node01/servers/server1/ejb/mgmt
28 (top)/nodes/MND06100738Node01/servers/server1/ejb/mgmt/MEJB
29 (top)/nodes/MND06100738Node01/servers/server1/ejb/AccessControlBean
....

What am I missing here? Does anyone here had already encountered the same problem?

Thanks in advance..., ayan
ayan sevi
Greenhorn

Joined: Sep 21, 2006
Posts: 21
Problem solved. A part of the code, which do not use the common utility for calling JNDI instead it calls directly to InitialContext for JNDI lookup.

Lessons learned.... lazy coder, be patient on tracing the error from the logs.



BTW, just one more question, is there any way to lookup JNDI directly without using the reference in the deployment descriptor (e.g. ejb-ref)?
I tried to called it directly just like this

// given the actual JNDI in the namespace was
// (top)/node......./servers/server01/jdbc/DS_MyApp
ctx.lookup("jdbc/DS_MyApp");

but it spits me out a NameNotFoundException. Any suggestion?

thanks..., bryan
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

One useful tool is the JNDI explorer. It can show you the names of various components bound to the JNDI server.

What about these types of lookups?

ic.lookup("java:comp/env/ejb/StatelessTimer");

ic.lookup("cell/nodes/baseNode01/servers/server1/ejb/com/examscam/ejb/StatelessTimer");

For a little tutorial on WebSphere JNDI naming, and the various ways of looking up an object bound to a JNDI tree, check out this tutorial:

Looking up JNDI Addressable Objects from a Client

Cheers!

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI reference error