| Author |
Cannot lookup JNDI resource for MySql JDBC driver on Tomcat & Axis
|
Paul Phillips
Greenhorn
Joined: Mar 02, 2004
Posts: 2
|
|
Hi, 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 org.gjt.mm.mysql.Driver driver. The full details are: Data Source URL: jdbc:mysql://127.0.0.1/delta?useUnicode=true&characterEncoding=UTF-8 JDBC Driver: org.gjt.mm.mysql.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: $CATALINA_HOME=/opt/tomcat $AXIS_HOME=/opt/tomcat/webapps/axis $AXIS_LIB=$AXIS_HOME/WEB-INF/lib 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/delta.java 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. TIA ~Paul 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 ]
|
 |
 |
|
|
subject: Cannot lookup JNDI resource for MySql JDBC driver on Tomcat & Axis
|
|
|