-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: NullPointerException Using C3P0 with Hibernate on Jetty
PostPosted: Thu Sep 17, 2009 4:50 pm 
Regular
Regular

Joined: Fri Oct 05, 2007 1:17 pm
Posts: 78
I am using the following:

Hibernate 3.2.6
C3P0 0.9.1.2
Jetty 6.1.11
OJDBC 6 (hitting an Oracle database)

When I deploy my web application to Jetty, I get the following:

Code:
17 Sep 2009 16:31:21,765: INFO  com.mchange.v2.c3p0.C3P0Registry.banner - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
17 Sep 2009 16:31:21,781: DEBUG com.mchange.v2.c3p0.management.DynamicPooledDataSourceManagerMBean.reinitialize - MBean: com.mchange.v2.c3p0:type=PooledDataSource[2sa1mf831jyqtyw1wehs7c|50988] registered.
17 Sep 2009 16:31:21,843: DEBUG com.mchange.v2.resourcepool.BasicResourcePool.incrementPendingAcquires - incremented pending_acquires: 1
17 Sep 2009 16:31:21,843: DEBUG com.mchange.v2.resourcepool.BasicResourcePool.incrementPendingAcquires - incremented pending_acquires: 2
17 Sep 2009 16:31:21,843: DEBUG com.mchange.v2.resourcepool.BasicResourcePool.incrementPendingAcquires - incremented pending_acquires: 3
17 Sep 2009 16:31:21,843: DEBUG com.mchange.v2.resourcepool.BasicResourcePool.<init> - com.mchange.v2.resourcepool.BasicResourcePool@1402d5a config: [start -> 3; min -> 3; max -> 15; inc -> 3; num_acq_attempts -> 30; acq_attempt_delay -> 1000; check_idle_resources_delay -> 0; mox_resource_age -> 0; max_idle_time -> 0; excess_max_idle_time -> 0; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 0; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false]
17 Sep 2009 16:31:21,859: DEBUG com.mchange.v2.resourcepool.BasicResourcePool.run - An exception occurred while acquiring a poolable resource. Will retry.
java.lang.NullPointerException
   at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(Unknown Source)
   at java.sql.DriverManager.getDriver(Unknown Source)
   at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:119)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:143)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:132)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


Here is my configuration of my datasource in Jetty:

Code:
<New id="myDataSource" class="org.mortbay.jetty.plus.naming.Resource">
        <Arg>MY_DS</Arg> <!-- jndi name -->
        <Arg>
            <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
                <Set name="driverClass">oracle.jdbc.OracleDriver</Set>
                <Set name="jdbcUrl">url</Set>
                <Set name="user">user</Set>
                <Set name="password">pwd</Set>
                <Set name="minPoolSize">1</Set>
                <Set name="acquireIncrement">1</Set>
                <Set name="maxPoolSize">10</Set>
                <Set name="idleConnectionTestPeriod">300</Set>
                <Set name="checkoutTimeout">0</Set>
                <Set name="maxStatementsPerConnection">50</Set>
            </New>
        </Arg>
    </New>


Finally, my persistence.xml file:

Code:
<persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>MY_DS</jta-data-source>
        <class>com.myapp.MyClass</class>
        <properties>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
            <property name="hibernate.c3p0.min_size" value="1"/>
            <property name="hibernate.c3p0.max_size" value="10"/>
            <property name="hibernate.c3p0.timeout" value="0"/>
            <property name="hibernate.c3p0.max_statements" value="50"/>
            <property name="hibernate.c3p0.acquire_increment" value="1"/>
            <property name="hibernate.c3p0.idle_test_period" value="300"/>
        </properties>
    </persistence-unit>


I have the Oracle driver and C3P0 in the classpath.

This error has been driving me nuts for a while, so any insight is really appreciated.

Thanks.


Top
 Profile  
 
 Post subject: Re: NullPointerException Using C3P0 with Hibernate on Jetty
PostPosted: Thu Sep 17, 2009 6:22 pm 
Regular
Regular

Joined: Fri Oct 05, 2007 1:17 pm
Posts: 78
After digging through the logs, I found this error as well:

Code:
java.lang.NullPointerException
   at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(Unknown Source)
   at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(Unknown Source)
   at java.sql.DriverManager.getDriver(Unknown Source)
   at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:223)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:119)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:143)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:132)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


Any clues as to what might cause this are appreciated.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.