https://bz.apache.org/bugzilla/show_bug.cgi?id=62670

            Bug ID: 62670
           Summary: driverManagerProtection in
                    JreMemoryLeakPreventionListener results in
                    java.sql.SQLException: No suitable driver found
           Product: Tomcat 8
           Version: 8.5.x-trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: srp.na...@gmail.com
  Target Milestone: ----

Created attachment 36128
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36128&action=edit
index.jsp file - can be dropped in any example webapps

Tomcat shows "java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost:5432/postgres ..." (applies to other drivers too)
when the driver class is not explicitly loaded using Class.forName("...")

The DriverManager
(https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html) spec
states that this is not required (The jdbc4+ drivers use service loaders to
register themselves)

This seems to be because of driverManagerProtection in
JreMemoryLeakPreventionListener. When this flag is set to 'false' in
conf/server.xml, the database connection works as expected. 

The bug was observed when postgresql-42.2.2.jar was placed in CATALINA_HOME/lib
or in CATALINA_HOME/webapps/examples/WEB-INF/lib/

-- 
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