File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes JNDI Data Source Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JNDI Data Source" Watch "JNDI Data Source" New topic
Author

JNDI Data Source

Marius Rafailescu
Greenhorn

Joined: Nov 10, 2012
Posts: 1
Hi there,
I recently started working on my first web service that has a class for server, one client and several helpful. Tomcat version is 5.5.
Communication between server and client is with SOAP so I used Apache Axis 1.4 and was able to configure it correctly.
And I have some tables in a database which i want to access from the server, but fail to do so under any circumstances.

I modified by adding context.xml file

between <Context ...> and </Context>

Also, I put in web.xml


Connecting to a database is this: (in server.java)


The project was done in NetBeans IDE with Tomcat. The JDBC library folder is in common\lib of tomcat so everything is ok from this point of view.

I noticed something very suspicious: if i put connection code in index.jsp file under web-pages, then it connects successfully. I think it's a problem of context, but I'm not sure, seeing in other tutorials as connecting occurs in other classes (not from index.jsp).

The error message that I receive in the console is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Thanks in advance.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16134
    
  21

Welcome to the JavaRanch, Marius!

Tomcat 5.5 is obsolete. Apache Axis (Axis1) is obsolete. Putting Java code on JSPs will make Bear growl at you.

Beyond that, if you could get a JNDI lookup to work at one point in your webapp, it should work anywhere in the webapp. I can't see anything obviously wrong with your examples, though.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI Data Source