Steps to help resolve common naming lookup problems
Which method are you using, corbaloc/corbaname,
for direct lookups or java:
for indirect lookups?
1. If you are using the corbaloc method, you can use the dumpNameSpace
utility to display contents of a namespace, if possible, from the machine
where application client is running.
e.g.
WebSphere_AppServer_Root/bin/dumpNameSpace.[sh|bat] -host
myhost.mycompany.com -port 901
OR
WebSphere_AppServer_Root/bin/dumpNameSpace.[sh|bin] -url
corbaloc:iiop:myhost.mycompany.com:901
See dumpNameSpace
examples.in the infocenter
See the 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") |
|
The following is how the object is seen in the
dumpNameSpace output: |
|
install_root\bin\dumpNameSpace -url
corbaloc::server.austin.ibm.com:9809 |
|
...
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
...
|
|
2. Can you see the object in the namespace?
- Yes:
- Check for spelling mistakes on lookup code versus what
is seen in namespace.
- Confirm you are connecting to the namespace of the
proper server, see the provider URL.
- If ProviderURL or ctx.lookup values
are picked up from the properties file, print out the variable values to
SystemOut to confirm the correct values are provided.
- If this does not resolve the problem, then go to What to do next.
- No: Use the administrative console to verify that:
- The server hosting the target resource is started.
- The Web module or EJB container, if applicable, hosting
the target resource is running.
- The JNDI name of the target resource is correct and
updated.
- If the problem resource is remote, that is, not on the
same node as the Name Server node, that the JNDI name is fully qualified,
including the host name. This is especially applicable to Network
Deployment configurations.
- If this does not resolve the problem, then go to What to do next.
If you are using the java: lookup method, you cannot use
dumpNamespace to see the lookup object. This is because the object is in
the application's own namespace.
1. Check your configuration against the following example of a
java: namespace lookup. This shows the mapping from the sample code
with the resource.xml, the
resource.xml with the
ibm-resource-bnd.xmi, and finally with
the object as seen in the namespace.
(where resource = web, application, appclient or ejbjar)
Code sample:
ctx = new
InitialContext();
Object obj = ctx.lookup("java:comp/env/plantsby/PlantsDS");
|
Note: Mapping is configured between the resource.xml and
ibm-resource-bnd.xmi files.
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>
|
2. The dumpNameSpace
utility can still be used to show the real object in the namespace as
defined in the binding file. This is different from that of the java:'s
namespace.
Sample piece of 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
. . .
|
If the configuration looks to be setup properly, when compared with the
preceding sample, then get a dump of the applications, java:, namespace
using the wsadmin
utility.
- Syntax
for dumping java: namespace
- Examples
dumping the java: namespace
What to do next?
If the preceding troubleshooting steps did not help solve your problem,
see the MustGather
for JNDI/Naming problems to continue investigation. |