This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot lookup JNDI resource for MySql JDBC driver on Tomcat & Axis  RSS feed

Paul Phillips
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to setup a Tomcat server with Axis that will connect to a local MySQL DB but use SOAP messages automatically generated by Axis to talk to clients.
I believe I have Tomcat and Axis essentially setup correctly. My trouble is with connecting to MySQL through the JDBC driver. Now here I get a little muddled as to what is supposed to happen, I have to lookup the JNDI device of the JDBC connector, once I have this in my app I can then use it to connect to the database. The way I think of this is getting a naming context in CORBA.
I have used the Tomcat Admin Panel to setup my database. Under DataSources I have created a JNDI resource named jdbc/TestDB, using the driver. The full details are:
Data Source URL: jdbc:mysql://
JDBC Driver:
username: delta
pass: pass (changed of course )
Max Active Connections: 4
Max Idle Connections: 2
Max Wait for Connection: 5000
Validation URL: select * from repository
I read somewhere that Fedora Linux (which is what I am using) / RH have a problem with using localhost in the DataSource URL and that's why I'm using the explicit IP address.
I have also set this up for Axis under "Tomcat Server -> Service -> Host -> /axis" in the admin control panel, but I used a different name for the JNDI name.
I have the following config:
I have put the mysql driver at $CATALINA_HOME/common/lib and in $AXIS_LIB for the JNDI connection I have setup. (I've only created two connections to see which one I can get to work).
The code I am using is as follows. On the server in $CATALINA_HOME/webapps/axis/delta/ I have:

After some testing I have figured out that it fails looking up "java:comp/env/", it just stops.
If anyone has any ideas please say, this is really annying the hell out of me now.

edit: I have worked out that I am throwing an javax.naming.NamingException with the message:
Naming Exception: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
[ March 02, 2004: Message edited by: Paul Phillips ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!