tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Mark.Gar...@cs.tcd.ie>
Subject RE: DriverclassName is required (mysql)
Date Tue, 01 Apr 2003 17:40:37 GMT
Hi Folks,
        I was using the Tomcat within the Java WebServices Development
Pack from Sun. I promptly got rid of it cos I like my dos output. 

Now instead of getting the error that the driverClassName is required,
now Tomcat says that it cannot load JDBC class null. This would be fair
enough only I've set the driverClassName property in the server.xml that
describes the datasource to be the org.gjt.mm.mysql.Driver class. It
looks like the name of the parameter that tells the the connection
factory which datasource to use is different to 'driverClassName'. Could
this have changed?

Thanks,
Mark.



-----Original Message-----
From: Mark.Gargan@cs.tcd.ie [mailto:Mark.Gargan@cs.tcd.ie] 
Sent: 01 April 2003 16:51
To: tomcat-user@jakarta.apache.org
Subject: DriverclassName is required (mysql)

Hi Folks,
            I'm trying to install jUDDI in my tomcat installation.
The installation is from the java webservices pack from the sun site. 
I'm trying to setup mysql as the underlying database for the UDDI
Registry.
 
I've inserted the following context into the server.xml as instructed in
the JNDI howto Datasources guide.
 
<!-- MYSQL datasource for jUDDI-->
            <Context path="/DBTest" docBase="DBTest" debug="5"
reloadable="true" crossContext="true">
               <Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt" timestamp="true" />
 
               <Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource" />
 
               <ResourceParams name="jdbc/TestDB">
                  <parameter>
                     <name>factory</name>
 
 
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                  </parameter>
 
                                                <!-- Maximum number of
dB connections in pool. Make sure you
                                                         configure your
mysqld max_connections large enough to handle
                                                         all of your db
connections. Set to 0 for no limit.
                                                         -->
                  <parameter>
                     <name>maxActive</name>
 
                     <value>100</value>
                  </parameter>
 
                                                <!-- Maximum number of
idle dB connections to retain in pool.
                                                         Set to 0 for no
limit.
                                                         -->
                  <parameter>
                     <name>maxIdle</name>
 
                     <value>30</value>
                  </parameter>
 
                                                <!-- Maximum time to
wait for a dB connection to become available
                                                         in ms, in this
example 10 seconds. An Exception is thrown if
                                                         this timeout is
exceeded.  Set to -1 to wait indefinitely.
                                                         -->
                                                         
                  <parameter>
                     <name>maxWait</name>
 
                     <value>10000</value>
                  </parameter>
 
                                                <!-- MySQL dB username
and password for dB connections  -->
                                                
                  <parameter>
                     <name>username</name>
 
                     <value>javauser</value>
                  </parameter>
 
                  <parameter>
                     <name>password</name>
 
                     <value>javadude</value>
                  </parameter>
 
            <!-- Class name for mm.mysql JDBC driver -->
                                                
                  <parameter>
                     <name>driverClassName</name>
 
                     <value>org.gjt.mm.mysql.Driver</value>
                  </parameter>
 
                                                <!-- The JDBC connection
url for connecting to your MySQL dB.
                                                         The
autoReconnect=true argument to the url makes sure that the
                                                         mm.mysql JDBC
Driver will automatically reconnect if mysqld closed the
                                                         connection.
mysqld by default closes idle connections after 8 hours.
                                                         -->
                  <parameter>
                     <name>url</name>
 
 
<value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
                  </parameter>
               </ResourceParams>
            </Context> 
 
Unfortunately when I go to call the test.jsp which in turn makes a call
to the init method in the foo class :-
 
public void init() {
    try{
      Context ctx = new InitialContext();
      if(ctx == null ) 
          throw new Exception("Boom - No Context");
 
      DataSource ds = 
            (DataSource)ctx.lookup(
               "java:comp/env/jdbc/TestDB");
 
      if (ds != null) {
        Connection conn = ds.getConnection();
              
        if(conn != null)  {
            foo = "Got Connection "+conn.toString();
            Statement stmt = conn.createStatement();
            ResultSet rst = 
                stmt.executeQuery(
                  "select id, foo, bar from testdata");
            if(rst.next()) {
               foo=rst.getString(2);
               bar=rst.getInt(3);
            }
            conn.close();
        }
      }
    }catch(Exception e) {
      e.printStackTrace();
    }
}
 
it begins to resolve the DataSource and then throws the following
exception..
 
javax.naming.NamingException: DbcpDataSourceFactory:  driverClassName is
required
      at
org.apache.naming.factory.DbcpDataSourceFactory.getObjectInstance(DbcpDa
taSourceFactory.java:199)
      at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFact
ory.java:177)
      at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:835)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
      at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at foo.DBTest.init(DBTest.java:26)
 
 
I can't really tell what the problem is as the driverClassName seems to
be defined in the xml.
The mysql-connector-java-2.0.14-bin.jar is placed in
${CATALINA.HOME}/common/lib so the classes are available? 
 
Anyone got any ideas? This is me falling at the first hurdle here.
Doesn't bode well for me at all. 
 
Thanks,
Mark.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message