Getting background information on Naming
In WebSphere Application Server versions V5.0 and later, the namespace is
broken up from one large name space to a namespace for each WebSphere
Application ServerJVM. See
logical view.
The most common problem resulting in a NameNotFoundException is when the
initial context has bootstraped to the wrong server/namespace. Remember
that each Application Server, node agent, and deployment manager has it's
own namespace.
Ensure the bootstrap port for the server you are binding to is specified.
The bootstrap port can be seen in the serverindex.xml as well as
in the administrative console.
If no port is specified, port 2809 is used as a default. This is the
default port for the Node Agent and will not have application or resource
objects in its namespace.
TroubleShooting steps to help resolve common naming lookup
problems
- Use the dumpNameSpace
utility to display contents of a namespace, if possible, from the machine
where application client is running. See dumpNameSpace
examples. Can you see the object in the namespace?
- Which method are you using for lookup, corbaloc/corbaname or Java™:
See following example of a corbaloc providerURL and
lookup
env.put(Context.PROVIDER_URL,"corbaloc::server.austin.ibm.com:9809");
ctx = new InitialContext(env);
Object obj = ctx.lookup(“
jdbc/PlantsByWebSphereDataSource”);</code>]
How object is seen in the dumpNameSpace Output
...
39 (top)/nodes/server/servers/server1/jdbc/petstore/PetStoreDB PetStoreDB
40
(top)/nodes/server/servers/server1/ jdbc/PlantsByWebSphereDataSource
PLANTSDB
41 (top)/nodes/server/servers/server1/jdbc/CatalogDB CatalogDB
...
See following example of a java: namespace lookup. This shows the
mapping from the sample code with the resource.xml, the resource.xml with
the resource-bnd.xmi, and finally with the object as seen in the
namespace.
- Code Sample
ctx = new InitialContext();
Object obj = ctx.lookup(“
java:comp/env/plantsby/PlantsDS”<
/tt>);
- web.xml
<resource-ref id="ResourceRef_1">
<res-ref-name>plantsby/PlantsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
- ibm-web-bnd.xmi
<resRefBindings xmi:id="ResourceRefBinding_1"
jndiName="jdbc/PlantsByWebSphereDataSource">
<bindingResourceRef
href="WEB-INF/web.xml#ResourceRef_1"/>
</resRefBindings>
How object is seen in the dumpNameSpace Output
39
(top)/nodes/server/servers/server1/jdbc/petstore/PetStoreDB
PetStoreDB
40
(top)/nodes/server/servers/server1/jdbc/PlantsByWebSphereDataSource
PLANTSDB
41 (top)/nodes/server/servers/server1/jdbc/CatalogDB
CatalogDB
What to do Next?
If the preceding steps did not help solve your problem, see the MustGather
for JNDI problems to continue investigation. |