You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Larry Rogers <La...@mercmarine.com> on 2000/11/17 04:56:16 UTC

Where to put JDBC drivers? (Was How to configure Mysql with Tomcat.)




Tony Keith <to...@paycom.net> wrote:
<snip>
>
>Noel Morgan wrote:
>
>> For Tomcat 3.2b6 I used:
>>
>> my setup:
>> Apache 1.3.12
>> RH 6.2 Linux 2.2.14-5.0
>>
>> Class.forName("org.gjt.mm.mysql.Driver").newInstance();
>> con =
>>
>DriverManager.getConnection("jdbc:mysql://localhost:3306/DatabaseName?user=dbuser&password=dbpassword");

>>
>> put the jdbc drivers in the classes folder of your
>> app like:
>>
>> cp -Rf $JDBC_HOME/org $MYAPP_HOME/WEB-INF/classes
>>
>
>I tried this but I still get the same error...
>Is there any other configuration to the web.xml?
>


I'm having a similar problem getting JDBCRealm, following the JDBCRealm HOWTO,
to work on Tomcat 3.2b7 on Apache 1.3.12 and NT 4.0.  I'm using the inet Type 4
driver with a user database in SQL Server 7.  When I try to start Tomcat, it
fails, and the jvm.stderr log contains the following:

2000-11-16 04:33:01 - ContextManager: Adding context Ctx( /examples )
2000-11-16 04:33:01 - ContextManager: Adding context Ctx( /admin )
2000-11-16 04:33:01 - ContextManager: Adding context Ctx(  )
2000-11-16 04:33:01 - ContextManager: Adding context Ctx( /simple )
2000-11-16 04:33:01 - ContextManager: Adding context Ctx( /test )
java.lang.RuntimeException: JDBCRealm.start.readXml:
java.lang.ClassNotFoundException: com.inet.tds.TdsDriver
     at org.apache.tomcat.request.JDBCRealm.contextInit(JDBCRealm.java:434)
     at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:493)
     at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)
     at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:197)
     at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:237)

and jvm.stdout has

Starting tomcat. Check logs/tomcat.log for error messages
FATAL:java.lang.RuntimeException: JDBCRealm.start.readXml:
java.lang.ClassNotFoundException: com.inet.tds.TdsDriver

There is nothing in tomcat.log.  I've opened the driver jar file, and the
TdsDriver class is definitely in there, and I get the same error whether I put
the jar in TOMCAT_HOME/lib or in WEB-INF/lib or in WEB-INF/classes.  I've even
tried adding it to my CLASSPATH and rebooting.

I wrote a little java console program to test the driver and it works fine by
running it with the -classpath option.

Thanks for any suggestions.

Larry

P.S. Here's the relevant portion of server.xml:

        <!-- Check if the request requires an authenticated role. -->
        <RequestInterceptor
             className="org.apache.tomcat.request.AccessInterceptor"
             debug="0" />

        <!-- Check permissions. -->
        <RequestInterceptor
             className="org.apache.tomcat.request.JDBCRealm"
             debug="99"
         driverName="com.inet.tds.TdsDriver"
          connectionURL="jdbc:inetdae:localhost:1433?database=AppSecurity"
         userTable="users"
             userNameCol="user_name"
             userCredCol="user_pass"
         userRoleTable="user_roles"
             roleNameCol="role_name" />