• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

NamingException

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,

I'm currently working on deploying my J2EE application to our development server. That server is running WebSphere, just like I am on my local box, but I'm getting an error when I try to access the database. Here's the error I'm getting:

javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server34, name: jdbc/ds1: First component in name jdbc/ds1 not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0

I get this error when the following line of code tries to execute:



So, I'm guessing that the datasource is not configured properly and that's what I'm going to investigate, but I wonder if anyone else could tell me what the problem is. Unfortunately, that exception doesn't mean a lot to me.

Thanks.
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Corey,
The two main things to check are that you can see the datasource in the admin console and that you don't have any errors starting up your app.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Jeanne said, check the datasources using the admin console. A possible issue could be that you've created them in a node or cell or server instance that your application can't access.
[ December 28, 2004: Message edited by: emm raha ]
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I seem to be having a similar problem. I�m new to WSAD, but I did manage to get the admin console open. Now I don�t know how to check the datasources using it.

I�m getting the exact same error as Corey, so any help would be greatly appreciated.

-Thanks.

EDIT:

I googled this error out (and still ended up back at the ranch ) so I didn't realize that when I posted this question I was talking about WSAD and you guys were talking about Websphere the server. Sorry about that.

That being said, I'm still having a problem with the same error as what Corey posted.
[ January 19, 2005: Message edited by: Chris Staten ]
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
It's actually a little easier to debug in WSAD. You don't need the admin console, just the test client.

In the server perspective, right click your server and select "universal test client." Then check under /jdbc whether your datasource is there.
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I opened the universal test client, then went under the JNDI Explorer, and finally clicked on the jdbc link. I could see the datasource there, but when I used the JNDI Name lookup tool on the top of that screen I got the following error:

Could not perform lookup wit the JNDI name: context:

Which, of course, is my error that I keep getting when I try to run my code. I was going to assume that it was my code that was causing this error, but now that I get it when using the Test Client I think it could be one of my datasource settings. Am I wrong in my reasoning?

On a side note, I�m new to WSAD and would love to get some kind of training with the program. I�ve looked at IBMs site and it looks like the class I should take is: course code WF331 �WebSphere Studio Application Developer V5 - Hands-on Overview �. Does anyone have any suggestions about this?

Thanks
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
Since your datasource shows up in the tree, it is configured properly. That text box is only for looking up EJBs, so we should expect it to fail for a datasource.

What kind of module are you querying the JNDI from? Web, EJB, ...
Also, check you have created a resource reference from that project's deployment descriptor to the JNDI name of the datasource.
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne, I am querying from a Servlet, here is the code:

the init param "dsNameOrcl" from line six of the code above is set to "test_datasource" in the DD.


I also have the resource ref declared in the DD:


I could be completely flawed in my understanding of JDBC since I�m new to that as well as WSAD. Thank you so much for your help.




EDIT: I had to replace the angle brackets with pipes in the web.xml code because they didn't show up when I viewed the post.
[ January 21, 2005: Message edited by: Chris Staten ]
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I�ve tried to break this back down to the most basic design that I can think so that debugging my problem will be easier on me. Here is a list of what I�ve done:

1. googled for tutorials on setting up datasources in WSAD and then retracing my steps to see if I missed anything. My settings look good to me (hrrrmmm, could be a problem with this statement )
2. I got rid of all my code except for the most necessary parts for making my connection and then debugging.
3. That�s it, nothing more!

Here is my Servlet code:


Here is a stack trace of my exception:


Any ideas?

-Thanks
[ January 24, 2005: Message edited by: Chris Staten ]
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
Everything looks right to me. Maybe double check the database password? I got this kind of error once when I was locked out.
 
Chris Staten
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Username and password are valid, I can log in under SQL Plus and Toad just fine. I�m really lost on this one. I�ve googled this out and found other people with this problem, just haven�t found the answer yet. If I ever figure out definitively what is causing this error, in my case, then I�ll post it here.
 
Die Fledermaus does not fear such a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic