Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Name not found in context "java:".

 
Alan Peltz
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to deploy to a websphere box at another location. I am testing an application, developed with Jboss3.2.1 as application server, where it works just fine in my websphere5.1.0.5 environment on my desktop.
I have a datasource that I set up in the administrative console with the JNDI name of jdbc/oel. I have tested the connection and it tests fine.
As soon as I do something on the application that I am testing that has to access the database I get the following errors. If you look at the code below you will see why there are so many.

javax.naming.NameNotFoundException: Name not found in context "java:".
.
.
javax.naming.NameNotFoundException: Name jdbc not found in context "java:".
.
.
javax.naming.NameNotFoundException: Name jdbc not found in context "java:".
.
.
A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.java.javaURLContextRoot
Context method: wookup(Name)
Context name: java:
Target name: comp/env/jdbc/oel/
Other data:
Exception stack trace: javax.naming.NotContextException: The object bound to comp/env/jdbc/oel in the context "java:" is not a context.
.
.
javax.naming.NotContextException: The object bound to comp/env/jdbc/oel in the context "java:" is not a context.
.
.
javax.naming.NameNotFoundException: Name not found in context "java:".
.
.
A Reference object looked up from the context "java:" with the name "comp/env/jdbc/oel" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ws.util.ResRefJndiLookupObjectFactory
Reference Factory Class Location URLs: null
Reference Class Name: java.lang.Object
Type: ResRefJndiLookupInfo
Content: com.ibm.ws.util.ResRefJndiLookupInfo@6e3151f4 ResRefJndiLookupInfo: Look up Name="jdbc/oel";JndiLookupInfo: jndiName="java:/jdbc/oel"; providerURL=""; initialContextFactory=""

Exception data follows:
javax.naming.ConfigurationException: Bad protocol: localhost
.
.
A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.java.javaURLContextRoot
Context method: wookup(Name)
Context name: java:
Target name: comp/env/jdbc/oel
Other data:
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is javax.naming.ConfigurationException: Bad protocol: localhost
.
.
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is javax.naming.ConfigurationException: Bad protocol: localhost
.
.
javax.naming.NameNotFoundException: Name not found in context "java:".
.
.
javax.naming.ConfigurationException: Bad protocol: localhost
.
.
javax.naming.ConfigurationException: Bad protocol: localhost
.
.
javax.naming.ConfigurationException: Bad protocol: localhost
.
.
javax.naming.ConfigurationException: Bad protocol: localhost


Here is the code from the dao:

String [] names = {"java:/jdbc/oel", "java:/jdbc/oel/", "java:jdbc/oel/", "java:jdbc/oel", "java:comp/env/jdbc/oel/", "java:/comp/env/jdbc/oel/", "java:comp/env/jdbc/oel", "java:/comp/env/jdbc/oel", "/jdbc/oel", "jdbc/oel", "/jdbc/oel/", "/jdbc/oel"}

for (int ii = 0; ii LESSTHAN names.length; ii++) {
try
{
javax.naming.InitialContext ic = new javax.naming.InitialContext();
ds = (DataSource) ic.wookup(names[ii]);
}
catch (NameNotFoundException e) {
logger.error(VHException.getStackTraceAsString(e));
}
catch (NamingException e) {
logger.error(VHException.getStackTraceAsString(e));
}
if (ds != null) {
break;
}
}


As you can see, I've been trying a lot of different JNDI names. I have been wallowing in this problem for days now. Any direction is helpful.
Thanks!
[ August 20, 2004: Message edited by: Alan Peltz ]
 
Vijay S. Rathore
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are you loggin if the connection is succesful? Maybe you already gor the connection by the end.
 
Alan Peltz
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question Vijay. At the end of the code that I have listed, I have the following:

if (ds == null) {
throw new NameNotFoundException("Unable to lookup OWSI datasource in JNDI tree.");
}

and at the end of all of those error messages, I get:

javax.naming.NameNotFoundException: Unable to lookup OWSI datasource in JNDI tree.

Thanks for looking Vijay.
 
Alan Peltz
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One other question for anybody out there. Jboss has a web-console where I can look and see all kinds of settings on the app server and invoke some Mbean methods. Does Websphere have something like this?
 
Vijay S. Rathore
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For WSAD you can use UTC to lookup JNDI references, and for Websphere Application server the information can be customized using Admin Console. I am not sure about any JMX support available with Websphere.

One more question, where are you testing your app, WSAD or after deploying it on Websphere.
[ August 20, 2004: Message edited by: Vijay S. Rathore ]
 
Alan Peltz
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have WSAD. I am testing it after deploying to WAS.
 
Pratap Shinde
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Declare <resource-ref> in web.xml.

For. E.G.
<resource-ref id="ResourceRef_1251416779852">
<description></description>
<res-ref-name>jdbc/oel</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Also if you are using RAD or some similar editor then I would suggest don't just add these entries manually. Better go to the 'References' tab and the add from there.
 
Samik Mukherjee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We have an application running fine in WAS 5.1. Recently we have migrated the application to WAS 6.1.0.27. Since then, whenever I try to load the application in 6.1, I get the following error.

A Reference object looked up from the context "uat-rubis-1Node01Cell/nodes/uat-rubis-1Node01/servers/server1" with the name "ext/gedom" was sent to the JNDI Naming Manager and was returned unprocessed. Reference data follows:
Reference Factory Class Name: com.sun.jndi.fscontext.FSContextFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: com.sun.jndi.fscontext.FSContext
Type: URL
Content: file:///opt/IBM/WebSphere/applications/rubis

I have not changed anything on the application, and the application is still running fine in 5.1 environment.

Any idea how to troubleshoot this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic