We just made a little progress though the solution is unacceptable.
After placing the DB2Java.jar into the lib/ext of the JDK, the driver is
loaded appropriately and a connection is created.

The question now is why Tomcat cannot use the driver if it is in the
"common" directory?

Andrew R Feller, Analyst
Subversion Administrator
University Information Systems
Louisiana State University
[EMAIL PROTECTED]
(office) 225.578.3737

-----Original Message-----
From: Andrew R Feller [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 15, 2007 8:51 AM
To: Tomcat Users List
Subject: RE: Tomcat DB2 JDBC issue

Marty,

 

AFAIK, those are the only two places to obtain the driver.  I currently
have DB2 Connect v9 installed on my machine, so I have the driver.

 

So far, we are able to get the driver working from a simple Java app
compiled via the command line and an application ran in Eclipse.  The
issue only occurs when we attempt to run it in Tomcat.  Maybe it is a
classloader issue?

 

I tried refactoring the code to use the DB2 DataSource directly and
receive this error in Tomcat:

 

javax.security.auth.login.LoginException:
java.lang.UnsatisfiedLinkError:
COM.ibm.db2.jdbc.app.DB2Connection.SQLConnect(Ljava/lang/String;II)I

        at COM.ibm.db2.jdbc.app.DB2Connection.SQLConnect(Native Method)

        at COM.ibm.db2.jdbc.app.DB2Connection.connect(Unknown Source)

        at COM.ibm.db2.jdbc.app.DB2Connection.<init>(Unknown Source)

        at COM.ibm.db2.jdbc.app.DB2ReusableConnection.<init>(Unknown
Source)

        at COM.ibm.db2.jdbc.DB2PooledConnection.getConnection(Unknown
Source)

        at COM.ibm.db2.jdbc.DB2DataSource.getConnection(Unknown Source)

        at COM.ibm.db2.jdbc.DB2DataSource.getConnection(Unknown Source)

        at
edu.lsu.infrastructure.java_authorization.sam_authorization.JDBCAuthoriz
ationModule.getConnection(JDBCAuthorizationModule.java:176)

        at
edu.lsu.infrastructure.java_authorization.sam_authorization.JDBCAuthoriz
ationModule.isUserInDirectory(JDBCAuthorizationModule.java:130)

        at
edu.lsu.infrastructure.java_authorization.sam_authorization.LSULoginModu
le.login(LSULoginModule.java:138)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)

        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

        at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

        at java.security.AccessController.doPrivileged(Native Method)

        at
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

        at
javax.security.auth.login.LoginContext.login(LoginContext.java:579)

        at
org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:362)

        at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut
henticator.java:258)

        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:417)

        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)

        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)

        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
63)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
4)

        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Http11Protocol.java:584)

        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

        at java.lang.Thread.run(Thread.java:619)

 

        at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)

        at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

        at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

        at java.security.AccessController.doPrivileged(Native Method)

        at
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

        at
javax.security.auth.login.LoginContext.login(LoginContext.java:579)

        at
org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:362)

        at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut
henticator.java:258)

        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:417)

        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)

        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)

        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
63)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
4)

        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Http11Protocol.java:584)

        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

        at java.lang.Thread.run(Thread.java:619)

 

Andrew R Feller, Analyst

Subversion Administrator

University Information Systems

Louisiana State University

[EMAIL PROTECTED]

(office) 225.578.3737

-----Original Message-----
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 15, 2007 8:40 AM
To: Tomcat Users List
Subject: Re: Tomcat DB2 JDBC issue

 

Hi Andrew-

 

Apparently the driver is only available thru WAS 

http://www-1.ibm.com/support/docview.wss?uid=swg21201371

 

or DB2-Client

http://www-306.ibm.com/software/data/db2/support/db2_9/

 

Anyone else?

M--

 

----- Original Message ----- 

From: "Andrew R Feller" <[EMAIL PROTECTED]>

To: "Tomcat Users List" <users@tomcat.apache.org>

Sent: Thursday, November 15, 2007 8:50 AM

Subject: Tomcat DB2 JDBC issue

 

 

Database: DB2 v7 OS390

Server: DB2 Connect v9, Tomcat 6.0.14, Java 1.6

Issue: LoginModule unable to load driver; raises SQLException "No

suitable driver found"

 

Connection String: jdbc:db2:blah

Driver: COM.ibm.db2.jdbc.app.DB2Driver

 

 

 

I am developing a custom JAAS LoginModule to go against a database for

authorization information.  Each web application will have a JAAS realm

declared within its Context.  While developing the LoginModule, I am

halted by an issue using the DB2Java library provided by IBM in Tomcat.

Whenever the LoginModule is invoked and attempts to create a connection,

it throws a SQLException of "No suitable driver found for ...".

 

 

To test whether this was a DB2 Connect issue or not, I wrote a simply

Java program that doesn't run in Tomcat to load the driver and create a

connection to the server using the CLI settings the Tomcat code is

using. It ran successfully. I also ran my unit test in Eclipse, which

used the same exact settings, and it too performed successfully. There

is an issue with Tomcat somehow, but I am unable to determine what. The

DB2java.jar was placed within Tomcat's lib directory, which is handled

by the common loader.

 

Error Log:

Caused by: java.sql.SQLException: No suitable driver found for

jdbc:db2:LSU

at java.sql.DriverManager.getConnection(DriverManager.java:602)

at java.sql.DriverManager.getConnection(DriverManager.java:207)

at

edu.lsu.infrastructure.java_authorization.sam_authorization.JDBCAuthoriz

ationModule.getConnection(JDBCAuthorizationModule.java:179)

.. 23 more

at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872)

at

javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

at java.security.AccessController.doPrivileged(Native Method)

at

javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:362)

at

org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut

henticator.java:258)

at

org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator

Base.java:417)

at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java

:128)

at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java

:102)

at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.

java:109)

at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2

63)

at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84

4)

at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

Http11Protocol.java:584)

at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:619)

 

 

 

Thank you for any help offered as this on puzzles me,

 

 

 

Andrew R Feller, Analyst

 

Subversion Administrator

 

University Information Systems

 

Louisiana State University

 

[EMAIL PROTECTED]

 

(office) 225.578.3737

 

 

 

 

 

---------------------------------------------------------------------

To start a new topic, e-mail: users@tomcat.apache.org

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to