DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43126>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43126

           Summary: Webapp Classloader put exclusive locks on (DB2) JDBC
                    driver native library?
           Product: Tomcat 6
           Version: 6.0.13
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


We have two web applications deployed to the same Tomcat 6.0.13 server on a
Windows host, and both applications need to connect to IBM content manager
(remote) to retrieve documents. The first one can connect to content manager and
retrieve documents. The second one encounters error when it tries to connect.

After some research, I found that the IBM content manager API used in our
application to connect to content manager uses DB2 type 2 driver to connect to
the content manager DB2 database. So I developed a simple web application that
demonstrate this problem.

This sample web application has one class, TestDB.java, that connects to DB2
database uses type 2 driver. It creates a DriverManager, obtains a JDBC
connection, then release the connection. This web application has one jsp,
TestDB.jsp, that invokes the TestDB java class.

Here are the steps I used to demonstrate the problem:

1. Make a copy of the attached TestDB.war, name the copy as TestDB2.war.
2. Deploy both TestDB.war and TestDB2.war to tomcat 6.0.13 server,
3. Open a browser, request
     http://localhost:8080/TestDB/jsp/TestDB.jsp
   This request finishes successfully, it prints out:

       Starting...
       Test finished.
       Done
4. Open a browser, request
     http://localhost:8080/TestDB2/jsp/TestDB.jsp
   This request results an error with stack trace appears in catalina console
and in the browser:

java.lang.IllegalStateException: Failed to get db connection: No suitable driver
found for jdbc:db2:CRISOP
        com.test.db2driver.TestDriver.createDbConnection(TestDriver.java:84)
        com.test.db2driver.TestDriver.getDbConnection(TestDriver.java:63)

For complete stack trace, see attached TestDBError.html file.

5. Bounce tomcat server,
6. This time, request 
     http://localhost:8080/TestDB2/jsp/TestDB.jsp
first. It finished successfully.
7. Request 
     http://localhost:8080/TestDB/jsp/TestDB.jsp
throws the error described above (step 4)

So it seems like once the first webapp loaded the DB2 JDBC native library, the
second webapp cannot load the same native library anymore.

I tested the same scenario on Tomcat 5.5.13 server, same results.

NOTE
----

To run the sample webapp on your box, make sure 

1. You have DB2 client (native libray) installed on that box, and 
2. Substitute the driver url and username/password in TestDB.java class to match
your environment, the re-compile this class.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to