Hi. Did you try putting your .jar files in \WEB-INF\lib of you webapp?
>>> "Tom Henricksen" <[EMAIL PROTECTED]> 3/28/2008 8:08 AM >>>
I have an application in Tomcat 5.0.30 that we are trying to get to use
JDBC through JNDI.
I am trying to follow along with
akarta-tomcat-5.0.30/webapps/tomcat-docs/jndi-datasource-examples-howto.
html.
I have setup the context.xml
<Context debug="4"
docBase="C:/Java/eclipse-europa/europa-workspace/bop-med/web"
path="/bop-med" reloadable="true"
workDir="work\Catalina\localhost\bop-med">
<Resource name="jdbc/medical"
type="javax.sql.DataSource"
password="password"
driverClassName="com.ibm.db2.jcc.DB2Driver"
maxIdle="2"
maxWait="5000"
validationQuery="select * from sysibm.SYSDUMMY1"
username="user"
url="jdbc:db2://server:50000/db"
maxActive="4"/>
</Context>
And I have setup the web.xml with
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/medical</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When I call the following code
initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/medical");
Connection conn = ds.getConnection();
System.out.println("DB Version : "
+
conn.getMetaData().getDatabaseMajorVersion());
conn.close();
I get the following error
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
at
com.advtechgrp.web.servlet.TestConn.processRequest(TestConn.java:37)
at
com.advtechgrp.web.servlet.TestConn.doGet(TestConn.java:20)
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(Applica
tionFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:79
9)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:57
7)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at
java.util.StringTokenizer.<init>(StringTokenizer.java:146)
at com.ibm.db2.jcc.DB2Driver.acceptsURL(DB2Driver.java:245)
at java.sql.DriverManager.getDriver(DriverManager.java:232)
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:773)
... 29 more
I have the DB2 jars in the common/lib
Any suggestions?
Thanks,
Tom Henricksen
Consultant
Advanced Technologies Group, Inc.
* Email: [EMAIL PROTECTED]
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of the company. Employees of Easter
Seals-Goodwill Northern Rocky Mountain are expressly required not to make
defamatory statements and not to infringe or authorize any infringement of
copyright or any other legal right by email communications. Any such
communication is contrary to company policy and outside the scope of the
employment of the individual concerned. The company will not accept any
liability in respect of such communication, and the employee responsible will
be personally liable for any damages or other liability arising.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of this
information is strictly prohibited.
Please report any inappropriate or abusive use of this email system to [EMAIL
PROTECTED]