JSF_One_spkr

Register for JSFOne, September 4th - 6th, 2008, the first conference dedicated to JSF and Seam technologies. I will be speaking, as well as Kito Mann, author Dan Allen, and author Michael Yuan.

org.apache.tomcat.dbcp.dbcp.SQLNestedException
Fri, 14 Oct 2005 04:04 AM GMT

I usually use Jboss and Tomcat combination. Once in a while I have to use Tomcat only, this is one of those times. This exception has been occuring since 2004 it looks like. But, since I rarely use Tomcat I am reporting it today. :)

I was trying to set up a JDBC DataSource using JNDI on tomcat and I receieved this SQLNestedException. I decided to log the error and let you in on the possible fix. The big thing to note is that now you no longer have resource-params like you used to. You now have to set up your JNDI resources by attribute only. In other words, database resources have gone from:

This:

<Context ...>
  ...
  <Resource name="jdbc/EmployeeDB" auth="Container"
            type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/EmployeeDB">
    <parameter>
      <name>username</name>
      <value>dbusername</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>dbpassword</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>org.hsql.jdbcDriver</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:HypersonicSQL:database</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>8</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>4</value>
    </parameter>
  </ResourceParams>
  ...
</Context>

To This:

<Context ...>
  ...
  <Resource name="jdbc/EmployeeDB" auth="Container"
            type="javax.sql.DataSource" username="dbusername" password="dbpassword"
            driverClassName="org.hsql.jdbcDriver" url="jdbc:HypersonicSQL:database"
            maxActive="8" maxIdle="4"/>
  ...
</Context>

Here is the stack trace that you may similarily have seen

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)
        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:585)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        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:868)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
        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.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:243)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
        ... 36 more

43 comments for org.apache.tomcat.dbcp.dbcp.SQLNestedException
spud_boy
Wed, 26 Oct 2005 02:19 PM GMT

This is a wonderful insight. It solved my problem. Greatly Appreciated. Thanks again...
bux
Thu, 27 Oct 2005 09:43 AM GMT

But big question is ¿Why resource-params doesn't work anymore?
Anonymous
Wed, 16 Nov 2005 02:38 AM GMT

Thanks Daniel! I was struggling with this on Tomcat 5.5.9 for 4 days, and finally came across your site via Google. Would have been nice if Apache Foundation would have notified users of the change, huh. Job well done!
Anonymous
Thu, 8 Dec 2005 06:41 PM GMT

It just solved the problem which confused me couple days ago. Thanks a lot.
Dominic
Mon, 12 Dec 2005 12:58 PM GMT

Brilliant. Thanks Daniel. This works perfectly well for me. Its unfortunate that users were not notified of the changes in tomcat. I am running tomcat 5.5.12, so if you have the same trouble then set up your JNDI resources by attribute only as posted by Daniel (above)
Anonymous
Sat, 25 Feb 2006 11:44 AM GMT

Great stuff, Daniel. Thanks for sharing this info. Alessio
Kingbell
Mon, 3 Apr 2006 08:53 AM GMT

Thanks Daniel, I was struck up for 2 days because of this.
Anonymous
Wed, 5 Apr 2006 05:20 AM GMT

Thanks! This rocks!
ed_bunker
Mon, 10 Apr 2006 10:11 PM GMT

And for Tomcat 5.0.*.* which is the correct configuration ? With the first one I get an SQLNestedException but on Tomcat site the suggested configuration is just that one... ???
Danno
Tue, 11 Apr 2006 09:13 PM GMT

Do you have more info?
ed_bunker
Thu, 13 Apr 2006 10:10 AM GMT

Do You are talking with me ? I've tried to change the configuration but I get the same error again...
Dan Hinojosa
Thu, 13 Apr 2006 04:28 PM GMT

Yes, Ed, send me what you got to dhinojosa {at} evolutionnext {dot} com. :)
Anonymous
Tue, 18 Apr 2006 12:42 PM GMT

Thank you very much,It solved my problem!But Why tomcat throw this exception?
Tom Cullen
Wed, 26 Apr 2006 08:22 AM GMT

I can not upload pictures in 'Togetherweserved" Error I get: Description: The server encountered an internal error () that prevented it from fulfilling this request
Blitzz
Tue, 2 May 2006 09:57 AM GMT

I am still unable to configure the Datasource, still throwing the same error. I have Included this in the servet.xml



I saw there is a error message as follows:
Caused by:

java.lang.NullPointerException at org.apache.derby.jdbc.InternalDriver.acceptsURL(Unknown Source)
at java.sql.DriverManager.getDriver(DriverManager.java:232)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 22 more

If you know how to fix this... help great appreciated...
Thanks
Danno
Wed, 3 May 2006 01:14 AM GMT

Blitzz, Judging by some of the documentation, the url cannot have backslashes. e.g. from http://publib.boulder.ibm.com/infocenter/cldscp10/index.jsp?topic=/com.ibm.cloudscape.doc/develop11.htm # jdbc:derby:a:/demo/sample Open a connection to the database stored in the directory \demo\sample on drive A (usually the floppy drive) on a Windows system. # jdbc:derby:c:/databases/salesdb jdbc:derby:salesdb These two connection URLs connect to the same database, salesdb, on a Windows platform if the system directory of the Cloudscape system is C:\databases.
Rahul
Thu, 4 May 2006 02:58 PM GMT

Hi all Please Hlep me on this I am connecting to oracle by creating datasource but i m getting the below error I am using 1. oracle 9i 2. Tomcate 5.5.16. I have gone through document from the tomcat site. 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) at foo.ConnectionPool.init(ConnectionPool.java:34) at org.apache.jsp.page_jsp._jspService(page_jsp.java:48) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) 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(Unknown Source) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(Unknown Source) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 23 more
Maybe I shouldda RTFM'd? I'll never know.
Mon, 15 May 2006 12:12 AM GMT

THANKS FOR SAVING MY HIDE! Not that I'd have failed to figure it out :-), but you saved me before I spent the couple hours on it. My Tomcat 5.5.x upgrade was ten minutes!
Rafael Naufal
Mon, 15 May 2006 02:15 AM GMT

Good post Daniel! I've been with this problem for some days and now it's solved. Has this problem started with Tomcat 5.5.x?
Anonymous
Mon, 15 May 2006 05:52 AM GMT

org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92) at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:301) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162) at org.hibernate.loader.Loader.doQuery(Loader.java:390) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218) at org.hibernate.loader.Loader.doList(Loader.java:1593) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:603) at com.ipt.bo.IPTSubscriberBO.articleInVault(Unknown Source) at com.ipt.bo.IPTSubscriberBO.articleInVaultStatus(Unknown Source) at com.ipt.bo.IPTSDESvcMgr.articleView(Unknown Source) at com.ipt.ctrlr.IPTSDECtrlr.doSDEService(Unknown Source) at com.ipt.ctrlr.IPTSDECtrlr.doGet(Unknown Source) 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.valves.AccessLogValve.invoke(AccessLogValve.java:526) 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:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) 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: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298) ... 34 more Caused by: java.util.NoSuchElementException: Timeout waiting for idle object at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:756) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95) ... 37 more
Najmuddeen
Wed, 17 May 2006 04:38 PM GMT

Hi, m using tomcat 4.1.30, still m getting an exception if i use attributes instead of params in Resource tag within context tag of server.xml Exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null
Anonymous
Sat, 27 May 2006 01:53 AM GMT

thank, you save my life
raikkonen
Fri, 2 Jun 2006 11:25 AM GMT

Hi I have the same problem. My application is accessible over the context name www.bfcinternational.com/bfcinternational/ but when I create a "response.sendRedirect("bfcinternational");" I got the error listed above. What's the problem. Thanks in advance
Mark
Sat, 3 Jun 2006 09:56 PM GMT

Your kudos is well deserved. Thanks for your post!
Frank Peng.
Mon, 5 Jun 2006 05:27 AM GMT

Hello! I got the same error but I think my configuration file is OK. The java file is listed bellow. I cannot figour out what is wrong. Please help! 2006-06-05 00:01:03,662 ERROR [http-80-Processor25] info.DatabaseInfo (DatabaseInfo.java:68) - Error when access database info org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (No controller is available to accept connections) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) /* * $Header: /cvsroot/mvnforum/myvietnam/src/net/myvietnam/mvncore/info/DatabaseInfo.java,v 1.10 2006/04/15 02:59:19 minhnn Exp $ * $Author: minhnn $ * $Revision: 1.10 $ * $Date: 2006/04/15 02:59:19 $ * * ==================================================================== * * Copyright (C) 2002-2006 by MyVietnam.net * * All copyright notices regarding MyVietnam and MyVietnam CoreLib * MUST remain intact in the scripts and source code. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Correspondence and Marketing Questions can be sent to: * info at MyVietnam net * * @author: Minh Nguyen * @author: Mai Nguyen */ package net.myvietnam.mvncore.info; import java.sql.Connection; import java.sql.DatabaseMetaData; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import net.myvietnam.mvncore.db.DBUtils; public class DatabaseInfo { private static Log log = LogFactory.getLog(DatabaseInfo.class); private String databaseProductName; private String databaseProductVersion; private String databaseUrl; private String databaseUsername; private String driverName; private String driverVersion; private String errorMessage; public DatabaseInfo() { Connection connection = null; try { connection = DBUtils.getConnection(); DatabaseMetaData dbmd = connection.getMetaData(); databaseUrl = dbmd.getURL(); databaseUsername = dbmd.getUserName(); databaseProductName = dbmd.getDatabaseProductName(); databaseProductVersion = dbmd.getDatabaseProductVersion(); driverName = dbmd.getDriverName(); driverVersion = dbmd.getDriverVersion(); } catch (Exception ex) { log.error("Error when access database info", ex); errorMessage = ex.getMessage(); } finally { DBUtils.closeConnection(connection); } } public String getDatabaseProductName() { return databaseProductName; } public String getDatabaseProductVersion() { return databaseProductVersion; } public String getDatabaseUrl() { return databaseUrl; } public String getDatabaseUsername() { return databaseUsername; } public String getDriverName() { return driverName; } public String getDriverVersion() { return driverVersion; } public String getErrorMessage() { return errorMessage; } }
Christine
Fri, 9 Jun 2006 09:27 AM GMT

I have encountered the following error message :- org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause: java.sql.SQLException: Data source rejected establishment of connection, message from server: "#HY000Host 'localhost.localdomain' is not allowed to connect to this MySQL server" at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:650) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808) at com.mysql.jdbc.Connection.(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:82) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:300) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:838) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:821) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518) at com.dvm.claim.model.connector.connect(connector.java:42) at com.dvm.claim.model.UtilClass.connect(UtilClass.java:29) at com.dvm.claim.model.UtilClass.getUser(UtilClass.java:39) at com.dvm.claim.model.User.login(User.java:25)
Lax
Thu, 29 Jun 2006 05:30 AM GMT

Hi Experts, I have a proble in jndi connection in Tomcat 4.1, please I need help on this. Here is the details. Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory ([Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) ********************************** JNDI configuration in server.xml: factory org.apache.commons.dbcp.BasicDataSourceFactory username lsunkam password test01 driverClassName com.microsoft.jdbc.sqlserver.SQLServerDriver url jdbc:microsoft:sqlserver://e-cognosys001:1433;DatabaseName=ecognosys;SelectMethod=cursor maxActive 20 maxIdle 10 maxWait -1 **************************** Connection object: public void setConnection ( ) { try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource) envCtx.lookup("jdbc/mydb"); Connection conn = ds.getConnection(); ds = (DataSource)(new InitialContext()).lookup("java:comp/env"); // connection = ds.getConnection(); connection = conn; Logger.log("jw: DB connection after setConnection() is called: " + connection); } catch ( NamingException e ) { e.printStackTrace(); return; } catch ( SQLException e ) { finallyCloseConnection(); e.printStackTrace(); } } ********************************* web.xml resource configuration: My data resource... jdbc/mydb javax.sql.DataSource Container
Laura Zapata Aspiazu
Wed, 2 Aug 2006 09:12 AM GMT

Thanks a lot Daniel. I was struggling with this on Tomcat 5.5.17 for few hours. Att: Laura Zapata from Ecuador
Anonymous
Tue, 8 Aug 2006 12:32 PM GMT

HI experts I tried all these.I m working with 5.5.17.But still i m getting the error SQLNestedException - Cannot create poolable ConnectionFactory.Kindly help me.
waseem
Wed, 9 Aug 2006 09:07 AM GMT

... ... it works fine, but i have to control maxActive, it works even if i set its value to zero.please confirm. i have to control connections of my pool
Jyoti Thakur
Mon, 28 Aug 2006 03:00 PM GMT

Hi, i have the same problem. I am using resourc tag as Please help me.
Thomas
Mon, 28 Aug 2006 04:01 PM GMT

Incredible! I had the same problem with Tomcat 5.5.16... Ich searched 3 days and looked around the whole tomcat-website! And the solution is, that the -etc.-tag isn't supported any longer. Just use attributes in the resource-tag... a stupid change which cost enough time... SO THANKS Dan for your post! It works!
WoofGrrrr
Tue, 12 Sep 2006 05:14 PM GMT

Has anyone ever successfully gotten an Application-managed (auth=Application) DataSource to work? When trying to open the connection using Datasource.getConnection(...), I pass in the correct username and password, but it doesn't work. The error String back from Oracle says invalid username/password. Everything worked fine with auth=Container and the correct username/password specified in the . Thanks in advance for any help anhyone can provide.
Anonymous
Tue, 17 Oct 2006 10:28 PM GMT

Good job, I was trying to do it from last couple of days. Finally got your comments, it is working now.
Anonymous
Sat, 6 Jan 2007 09:09 PM GMT

You need to tell people over at Apache this so that they can fix there example that they show and led me to beleive their incorrect example was right.  Wow thanks a lot.
RJ
Tue, 9 Jan 2007 08:44 PM GMT

Great Work Daniel! You saved Moolah...
Anonymous
Tue, 3 Apr 2007 08:56 AM GMT

Thanks a lot Daniel! I was struggling with this issue on Tomcat 5.5.20 for couple of days, and finally happened to see your blog via Google. Though people are facing/reporting this issue since 2005, wonder why Apache Foundation did not update the JNDI configuration page in tomcat site for the changes. It solved my problem. Well Appreciated!
Anonymous
Mon, 18 Jun 2007 06:23 PM GMT

Thank you so much for this solution. I would have burned rubber on this forever.
Vijay
Fri, 29 Jun 2007 03:06 PM GMT

Excellent!! This issue was trubbling us since a long... Thanks a ton!
Anonymous
Fri, 31 Aug 2007 01:59 PM GMT

Hi,

I'm using Tomcat 5.5.23 and I have error: no suitable driver.

I tried to change my server.xml as I red but it stil doesn't works.

Is it correct mapping datasource in server.xml, or have I to map it into META-INF/context.xml?

Is there a problem with ojdbc14.jar?

Have I to put it into common/lib or server/lib?

Please help!!!!!

Thanks a lot

Anonymous
Tue, 4 Sep 2007 08:48 AM GMT

Hi, I tried following instructions to configure my DataSource, but now I get error:

Cannot create PoolableConnectionFactory at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)

This is my context.xml file

<font color="#008080" size="2"> <p align="left"><

<p align="left"><

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

<p align="left"> 

</

</font><font color="#3f7f7f" size="2">Context </font><font color="#7f007f" size="2">docBase</font><font size="2">=</font><font color="#2a00ff" size="2">"myContext&quot; </font><font color="#7f007f" size="2">path</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;/myContext&quot; </font><font color="#7f007f" size="2">reloadable</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;true&quot;</font><font color="#008080" size="2">></font><font color="#3f7f7f" size="2">Resource </font><font color="#7f007f" size="2">name</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;jdbc/myds&quot; </font><font color="#7f007f" size="2">auth</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;Container&quot; </font><font color="#7f007f" size="2">type</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;javax.sql.DataSource&quot; </font><font color="#7f007f" size="2">user</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;user&quot; </font><font color="#7f007f" size="2">password</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;password&quot; </font><font color="#7f007f" size="2">driverClassName</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;oracle.jdbc.driver.OracleDriver&quot; </font><font color="#7f007f" size="2">url</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;jdbc:oracle:thin:@host:port:sid&quot; </font><font color="#7f007f" size="2">maxActive</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;100&quot; </font><font color="#7f007f" size="2">maxIdle</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;30&quot; </font><font color="#7f007f" size="2">maxWait</font><font size="2">=</font><font color="#2a00ff" size="2">&quot;5000&quot;</font><font color="#008080" size="2">/></font><font color="#3f7f7f" size="2">Context</font><font color="#008080" size="2">></font>

Can anyone help me?

 

Thanks

nisha
Mon, 17 Dec 2007 05:08 AM GMT

Thank u so much! I have been struggling with this problem for a week now..who'da thought that the solution was actually so simple....thanks man....perfect solution! ;-)
Anonymous
Fri, 18 Jan 2008 11:55 AM GMT

Amazing Maaaan, My Sinciere thanks to you! I was knocking my head placing <context> in several places and nesting it with diferent tags, I shall notify Apache soon!