The driver has to be in tomcat's common/lib so tomcat's internal
classloader can see it. Don't know what the equivalent is in Eclipse.
Additionally, when in common/lib it should be removed from WEB-INF/lib
of your webapp to avoid classloader problems.
--David
David Uctaa wrote:
> Running Tomcat 5.5.17 through Eclipse 3.2.1
> Using jdk1.5.0_08
> OS = Windows XP
>
> --------------------
> server.xml contains the following within the <Server> element:
>
> <GlobalNamingResources>
> <Resource auth="Container" driverClassName="
> com.ibm.as400.access.AS400JDBCDriver" maxActive="30" maxIdle="2"
> maxWait="5000" name="jdbc/myDatabase" password="pw" type="
> javax.sql.DataSource" url="jdbc:as400://abc.def.com" username="uid"/>
> </GlobalNamingResources>
>
> ------------------
> the web application's context.xml contains the following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path="/TestBed" reloadable="true">
> <ResourceLink global="jdbc/myDatabase" name="jdbc/myDatabase"
> type="javax.sql.DataSource" />
> </Context>
>
> -----------------
> my servlet code contains the following:
>
> InitialContext ctx = new InitialContext();
> Context envCtx = (Context) ctx.lookup("java:comp/env");
> ds = (DataSource) envCtx.lookup("jdbc/myDatabase");
> con = ds.getConnection();
>
> ---------------
> jt400.jar contains the driver class
> com.ibm.as400.access.AS400JDBCDriver and
> the jar files resides in WEB-INF/lib under my web app.
>
> -------------
> the ds.getConnection call is causing the following exceptions to be
> thrown:
>
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
> class 'com.ibm.as400.access.AS400JDBCDriver'
> at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(
> BasicDataSource.java:766)
> at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(
> BasicDataSource.java:540)
> at com.nuhorizons.util.TestStuff.doPost(TestStuff.java:48)
> at com.nuhorizons.util.TestStuff.doGet(TestStuff.java:34)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:148)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :869)
> at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
>
> (Http11BaseProtocol.java:664)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:527)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.ClassNotFoundException:
> com.ibm.as400.access.AS400JDBCDriver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:164)
> at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(
> BasicDataSource.java:760)
> ... 19 more
>
> --------------
>
> What setting in Eclipse am I overlooking?
>
> Many thanks,
> David
>
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]