|
Problem(Abstract) |
In WebSphere Application Server 5.0.x, a JNDI lookup of a
resource (i.e. data source, queue connection factory, mail session) may
succeed when it is done within a servlet or EJB running within WebSphere,
but fail with a NameNotFoundException when it is done in a separate
process such as a stand-alone thin client or J2EE application client. Why
does this happen? |
|
|
|
Resolving the
problem |
The WebSphere 5.0 Naming service works differently than in
previous versions of WebSphere. Resources are bound to a specific server
root. The names used to look up these objects must be qualified so as to
select the correct server root. Each server has its own server root
context. So if the JNDI lookup of the resource (for example, jdbc/ds) is
done in an application running in the same server process, it will
succeed. It will fail if done outside of the server process because the
initial context for the client is different from the server application's
initial context. When doing the lookup from the client, it is necessary to
use the fully qualified JNDI name for the resource. For a relative JNDI
name of "jdbc/ds", the fully qualified JNDI name would be similar to
"cell/nodes/node_name/servers/server_name/jdbc/ds". The
exact fully qualified JNDI name can be obtained by running the
dumpNameSpace utility (in the <WebSphere root>/bin directory). |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|