It does have merit to keep associated jars together except in those rare occasions where the jar has to be in the classloader heirarchy at a place visible to both tomcat's internal code and the webapp's. In that case it has to be in common/lib and not in any descendant classloader. To do what you suggest requires the app have it's own pooling library and use the factory attribute in the Resource def.

--David

Howard Watson wrote:

If the app still had errors with the .jar file in the webapps own \WEB-INF\lib 
then something else is broken (called a test). Since his webapp docBase is 
outside the Tomcat directory structure there is merit with having associated 
.jar files in that docBase. And in instances where there are multiple Tomcats 
running and perhaps multiple versions, then keeping associated files with your 
app has merit also.

David Smith <[EMAIL PROTECTED]> 3/28/2008 8:45 AM >>>
Bad suggestion. It should exist in one and only one place. That place is common/lib for tc 5.0, 5.5 so it's visible to both tomcat's internal code and the webapp.

--David

Howard Watson wrote:

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]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [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]



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