tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@gopivotal.com>
Subject Re: Reg: Connection pool
Date Mon, 07 Oct 2013 11:08:08 GMT
On Oct 7, 2013, at 6:52 AM, Anu Prab <anuprab2@gmail.com> wrote:

>> Hi,
> 
>> 
> 
>> 
> 
>> The Tomcat version I am using is 7.0.40 and the connection pool is
> 
>> tomcat-jdbc. I am having trouble configuring the connection pool. The
> 
>> configuration does not trouble as long as I do not include initialSize
> 
>> and factory attributes. But when I include any of these two, Tomcat
> 
>> starts throwing the below exception:
> 
>> 
> 
>> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC
> 
>> driver class 'oracle.jdbc.OracleDriver'
> 
>>       at
> 
>> 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
> 
>>       at
> 
>> 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
> 
>>       at
> 
>> 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getLogWriter(BasicDataSource.java:1098)
> 
>>       at
> 
>> 
> org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:350)
> 
>>       at
> 
>> 
> org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory.getObjectInstance(BasicDataSourceFactory.java:156)
> 
>>       at
> 
>> 
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
> 
>>       at
> 
>> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
> 
>>       at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
> 
>>       at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> 
>>       at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> 
>>       at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
> 
>>       at
> 
>> 
> org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1093)
> 
>>       at
> 
>> 
> org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:672)
> 
>>       at
> 
>> 
> org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:271)
> 
>>       at
> 
>> 
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> 
>>       at
> 
>> 
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> 
>>       at
> 
>> 
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
> 
>>       at
> 
>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> 
>>       at
> 
>> 
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
> 
>>       at
> 
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> 
>>       at
> 
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
> 
>>       at
> 
>> 
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
> 
>>       at
> 
>> 
> org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
> 
>>       at
> 
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> 
>>       at
> 
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> 
>>       at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> 
>>       at
> 
>> 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 
>>       at
> 
>> 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 
>>       at java.lang.Thread.run(Thread.java:722)
> 
>> Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
> 
>>       at
> 
>> 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
> 
>>       at
> 
>> 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
> 
>>       at
> 
>> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(Ba
> 
>> sicDataSource.java:1420)
> 
>> 
> 
>> 
> 
>> Why is this happening
> 
> 
> 
> It's happening because you're trying to use a JDBC driver that cannot be
> loaded.  Where do you have your Oracle driver?  It should be in
> CATALINA_BASE/lib or CATALINA_HOME/lib.
> 
> 
> 
>> ClassNotFoundException: oracle.jdbc.OracleDriver
> 
> 
> 
>> and why this happens specifically when I include these two attributes?
> 
> 
> 
> By default the pool is not going to make any connections to the database
> when it is created.  Because it doesn't make any connections, it doesn't
> need the driver.  If you set "initialSize" to something greater than 0, it
> will create connections at start up and thus it will need the driver class.
> 
> 
> 
> Dan
> 
> 
> 
>> Any help is appreciated. Thanks.
> 
>> 
> 
>> 
> 
>> -Anu
>>> 
> 
> Hi,
> 
> Yes Dan, you are right. I placed the jar in the correction location now..
> Thanks for the help. However, am now facing the below exception.
> 
> WARNING: Unexpected exception resolving reference
> java.sql.SQLException: invalid arguments in call
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
>        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:236)
>        at
> oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
>        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
>        at
> oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
>        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)

This is an Oracle exception that is occurring when the pool is trying to connect to the database.

  1.) Verify your connection information.  Feel free to post it (i.e. your <Resource/>
tag) here, sans user / password info, perhaps someone on the list will see the issue.

  2.) Try connecting to your database with a stand alone Java app using the same connection
information.  A good stand alone app would be a third party tool like henplus or SQuirreL,
but you could just create a class with "public static void main()" and try to connect.

  3.) Check with your DBA.

Dan

>        at
> org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
>        at
> org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
>        at
> org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:702)
>        at
> org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:634)
>        at
> org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:488)
>        at
> org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
>        at
> org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
>        at
> org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
>        at
> org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:539)
>        at
> org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:237)
>        at
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
>        at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
>        at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
>        at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
>        at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
>        at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
>        at
> org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1093)
>        at
> org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:672)
>        at
> org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:271)
>        at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>        at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>        at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
>        at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>        at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>        at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>        at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
>        at
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
>        at
> org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>        at java.lang.Thread.run(Thread.java:722)
> 
> This is happening whenever I change the value of initialSize property to
> something greater than 0.
> 
> -Anu


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message