Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 64948 invoked from network); 20 Jun 2003 06:45:38 -0000 Received: from mail01.discoveryhealth.co.za (HELO dhcpout1.discoveryhealth.co.za) (196.34.86.46) by daedalus.apache.org with SMTP; 20 Jun 2003 06:45:38 -0000 Received: from dhtrend2 (172.24.158.12) by dhcpout1.discoveryhealth.co.za (NPlex 6.0.021) id 3B005CB90017E345 for commons-user@jakarta.apache.org; Sat, 2 Jun 2001 08:27:56 +0200 Received: from dhexchange0.discoveryhealth.co.za (172.24.159.108) by dhcpin1.discoveryhealth.co.za (NPlex 5.5.015) id 3EDA7EBA00140D16 for commons-user@jakarta.apache.org; Fri, 20 Jun 2003 08:27:48 +0200 Received: by dhexchange0.discoveryhealth.co.za with Internet Mail Service (5.5.2653.19) id ; Fri, 20 Jun 2003 08:45:41 +0200 Message-ID: <600479923310D711B44D000476DFD22F565334@dhexchange0.discoveryhealth.co.za> From: Dawid Van Der Merwe To: 'Jakarta Commons Users List' Subject: RE: [DBCP] Configuring DBCP for Tomcat/Oracle Date: Fri, 20 Jun 2003 08:45:39 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Michael. Does it work when you've got the resource configured in the element in your server.xml file? Like so: username user password ****** driverClassName oracle.jdbc.driver.OracleDriver url jdbc:oracle:thin:@db.server.net:1528:RDB maxActive 2 maxIdle 1 -----Original Message----- From: Michael Holly [mailto:mholly@talisentech.com] Sent: 19 Thursday June 2003 10:33 To: Jakarta Commons Users List Subject: [DBCP] Configuring DBCP for Tomcat/Oracle I am running Tomcat 4.1.18, Java 1.3.1, Win 2k Part of getting on automated testing(junit et. al.) was getting the ANT build to undeploy and then redeploy the war after it got created. Part of getting this dynamic undeploy/deploy cycle to work was removing the from the server.xml. The reason I want to do this is I have 2 connection pools located there. In a dynamic deploy tomcat generates it's own context for the app. I found there were three ways I could do this. #1. put the connection pool into the section of server.xml #2. create a $APP_NAME.xml file that contains the context of the app and put it into $TOMCAT_HOME/webapps. Both the Tomcat manager and Admin apps do this. #3. Possibly put the context info in the section for the server. I have tried both #1 and #2 and I am getting a java.sql.SQLException: Cannot load JDBC driver class 'null' error when the DBCP is accessed. The classes12.jar file is located in $TOMCAT_HOME/common/lib. It has been renamed from .zip to .jar Some things i have tried: I have tried: 1. config #1, 2. config #2, 3. replacing the driverClassName oracle.jdbc.OracleDriver with driverClassName oracle.jdbc.pool.OracleConnectionPoolDataSource Thess did not help Some Observations. 1. The app seems to deploy correctly. ( I can see app in Tomcat manager ) 2. When I alter the JNDI name(adding and 'x' to the end) I get a javax.naming.NameNotFoundException: Name oracle_tsrx is not bound in this Context error. So from this it appears that the Context is being created but something in classes12.jar is not being found or referenced properly. 3. Before I went to this new configuration, this worked with a hard coded in the server.xml that contained the references for the pools. Currently the classes12.jar is located in $TOMCAT_HOME/common/lib. Is this the correct location for this class? Are all jars in $TOMCAT_HOME/common/lib automagically referencable? I understand that the pool classes need to be here because they are referenced by both the app and the container. Is there any way for me to iterate through a context and see what it's properties/parametes/resources are? As you can tell from the included files I am using configuring a connection pool for two different connections. Below are my files for Option #2 (the one I would like to go with). WEB.XML--------------------------------------------------------------------- ---------------- TSR Application This is the web configuration for the TSR application TestServlet net.talisen.tsr.servlets.TestServlet ControllerServlet net.talisen.tsr.servlets.ControllerServlet FileDownloadServlet net.talisen.tsr.servlets.FileDownloadServlet StartupServlet net.talisen.tsr.servlets.StartupServlet 1 JUnitEETestServlet JUnitEE test runner org.junitee.servlet.JUnitEEServlet TestServlet /test StartupServlet /startup ControllerServlet /controller FileDownloadServlet /download JUnitEETestServlet /TestServlet/* Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. jdbc/oracle_tsr javax.sql.DataSource Container Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. jdbc/oracle_myco javax.sql.DataSource Container WEB.XML--------------------------------------------------------------------- ---------------- TSR.XML--------------------------------------------------------------------- ---------------- factory org.apache.commons.dbcp.BasicDataSourceFactory driverClassName oracle.jdbc.OracleDriver url jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.myco.com)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SID = MYCO))) username tsr_app password actuator maxActive 20 maxIdle 10 maxWait -1 validationQuery select 'validationQuery' from dual testOnBorrow true factory org.apache.commons.dbcp.BasicDataSourceFactory driverClassName oracle.jdbc.driver.OracleDriver url jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myserver.myco.com)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SID = MYCO))) username myname password mypass maxActive 20 maxIdle 10 maxWait -1 validationQuery select 'validationQuery' from dual testOnBorrow true TSR.XML--------------------------------------------------------------------- ---------------- My log even shows the look up of the datasource in the context 2003-06-13 13:42:51,009 DEBUG tsr.DBCmd 208 - Looking up db 2003-06-13 13:42:51,009 DEBUG tsr.DBCmd 214 - Getting connection to java:/comp/env/jdbc/oracle_tsr 2003-06-13 13:42:51,019 ERROR tsr.DBCmd 234 - SQL EXCEPTIONCannot load JDBC driver class 'null' java.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:529) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3 12) at net.talisen.tsr.DBCmd.open(DBCmd.java:219) at net.talisen.tsr.DBCmd.open(DBCmd.java:186) at net.talisen.tsr.model.customer.Customer.(Customer.java:70) at test.talisen.tsr.model.customer.CustomerTest.testCustomer(CustomerTest.java: 74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.junitee.runner.TestRunner$1.run(TestRunner.java:72) at org.junitee.runner.TestRunner.run(TestRunner.java:95) at org.junitee.servlet.JUnitEEServlet.runTests(JUnitEEServlet.java:224) at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:195) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline. java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1040) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151 ) at java.lang.Thread.run(Thread.java:536) 2003-06-13 13:42:51,179 ERROR customer.Customer 139 - Customer was not able to be added. Sorry for the HUGE post. Thanks for the help Michael --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org