https://issues.apache.org/bugzilla/show_bug.cgi?id=48214

           Summary: JDBC DriverManager: no suitable driver found after
                    context reload
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: rainer.frey+tom...@inxmail.de


Created an attachment (id=24550)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24550)
Web Application that shows this behavior

This occurs with 6.0 Trunk, built from SVN yesterday (2009-11-16):

I have a Servlet that's loaded on 
startup and does following in its init() method:

try
{
        Class.forName( driver );
}
catch( ClassNotFoundException x )
{
        log( x.toString(), x );
}
Connection con = null;
try
{
        con = DriverManager.getConnection( url, user, pass );
        log( "connection established: " + con.toString() );
}
catch( SQLException x )
{
        log( x.toString(), x );
        throw new ServletException( x.toString(), x );
}

After starting Tomcat, I get the following expected output:

Nov 16, 2009 1:56:11 PM org.apache.catalina.core.ApplicationContext log
INFO: DBTestServlet: connection established: 
org.postgresql.jdbc4.jdbc4connect...@17ec9f7
Nov 16, 2009 1:56:12 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()

But when reloading the context, I get the following 
exception:

Nov 16, 2009 1:56:32 PM org.apache.catalina.core.ApplicationContext log
SEVERE: DBTestServlet: java.sql.SQLException: No suitable driver found for 
jdbc:postgresql://127.0.0.1/inxmail
java.sql.SQLException: No suitable driver found for 
jdbc:postgresql://127.0.0.1/inxmail
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at com.inxmail.test.DBTestServlet.init(DBTestServlet.java:49)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)

I tested with Java 6 (1.6.0_17) and JDBC 3 and 4 Drivers for Oracle 
(ojdbc1.4.jar from Oracle 10, ojdbc6 from Oracle 11) as well as PostgreSQL.

Attached is a minimal webapp that exhibits this behavior. DB connection
configuration is in /META-INF/context.xml. Also attached is the full source of
the servlet.

This webapp works in 6.0.20.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to