Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 8454 invoked from network); 8 Nov 2007 18:09:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2007 18:09:07 -0000 Received: (qmail 98738 invoked by uid 500); 8 Nov 2007 18:08:43 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 98717 invoked by uid 500); 8 Nov 2007 18:08:43 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 98700 invoked by uid 99); 8 Nov 2007 18:08:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 10:08:43 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of emailnbw@gmail.com designates 64.233.184.226 as permitted sender) Received: from [64.233.184.226] (HELO wr-out-0506.google.com) (64.233.184.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 18:09:22 +0000 Received: by wr-out-0506.google.com with SMTP id m59so128944wrm for ; Thu, 08 Nov 2007 10:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=W6sJbeKnn9VbvzIYLwgbMoodbIHP0DhbhMPqLu0FXws=; b=NHYpIVr6bFOaAtjID9dWwKb6J6bHcvNyySp3kc64RIRH1hY60il7KmgvYAL7y08ia59uZfuacgVyxZvgT+IHdXAGg8xRLq+NmkEdsfY/egRBgO6Atq3bMwZiHqPb8Cy1qgoA4KsaFLCldLuV0VOR4TWl8U/j+VPUSIChwWFBQ5M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=gEOwDvrISTTNilcXjl3XrwB/jSXoXmgP11HcweGcTq8LboZFmjiZ6a1r6Bi0aby9Xgyt1tY9Y69HS9y/w1COGEMJsFqru9cIHnsylkPKGRVba+myD4+qn5Y9GCJqrImybvI15Rby7HDC6sdKoGIOkwoiB5rsfSeDu+6HHd91Qc8= Received: by 10.100.34.16 with SMTP id h16mr1316879anh.1194545245438; Thu, 08 Nov 2007 10:07:25 -0800 (PST) Received: by 10.90.93.10 with HTTP; Thu, 8 Nov 2007 10:07:25 -0800 (PST) Message-ID: Date: Thu, 8 Nov 2007 13:07:25 -0500 From: NBW To: "Tomcat Users List" Subject: Problem configuring JDBC DataSource Tomcat 5.5.23 / MySQL 5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Hi, I'm having difficulty configuring a container managed JDBC resource. I've read several posts in the tomcat-users archives (discussing similar issues) as well as the documentation at: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html My environments looks like this: Tomcat 5.5.23 (Windows XP) MySQL 5.0.45 MySQL Connector/J 5.1.5 JDK 1.6.0_02 My context.xml is deployed in %TOMCAT_HOME%/webapps/myApp/META-INF and contains the following: My web.xml file is located in %TOMCAT_HOME%/webapps/myApp/WEB-INF and contains among other things the following: DB Connection jdbc/MyDB javax.sql.DataSource Container ... The MySQL driver JAR is deployed in %TOMCAT_HOME%/webapps/myApp/WEB-INF/lib Finally, my code trying to load the resource is the following: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource myDataSource = (DataSource) envCtx.lookup("jdbc/MyDB"); When I deploy and run I am getting the following exception: 2007-11-08 12:41:31,593 [Thread-1] ERROR Unable get a SQL connection: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) [SNIP] at com.myApp.InitServlet.init(InitServlet.java:56) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507) at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476) at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) at java.sql.DriverManager.getDriver(DriverManager.java:253) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 36 more What is interesting is when I look at Catalina's MBeans using JConsole I can see the following DataSource /myApp - localhost - javax.sql.DataSource "jdbc/MyDB" but most of its attributes are empty (eg. username, url, password) and the ones which do have values such as maxIdle have defauls (eg. maxIdle is set to 8) whereas my context Resource sets it to 30. I've been over and over the config. and don't see where I am doing anything different then the documentation suggests. Does anyone have any advice? TIA. -NBW --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org