Hi,

I found a problem when using DriverManager.getConnection() with a build from 
current 6.0 SVN (this morning). Basically 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 (by touching web.xml), 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)
        at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
        at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
        at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
        at 
org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1192)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1290)
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at 
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
        at java.lang.Thread.run(Thread.java:619)
Nov 16, 2009 1:56:32 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /testdb threw load() exception

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.

Everything works fine with Tomcat 6.0.20.

The error originally occured in a much more complicated application with a 
home-grown DB connection pool, but the servlet I mentioned above exhibits 
this behavior. For anyone willing to test: here is a  .war file with this 
servlet, please edit web.xml to fill in your DB connection details.
http://download.inxmail.com/data/user/rfy/testdb.war

I'm testing our application for compatibility with the upcoming 6.0.21 
release, so I'd be grateful if s.o. could try to verify whether this is a 
Bug, so it has a chance to be addressed before 6.0.21

Thanks, and sorry for the lengthy message
Rainer




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

Reply via email to