Results 1 to 7 of 7

Thread: c3p0 with Spring 2.5 and Hibernate 3 throwing exception

  1. #1

    Question c3p0 with Spring 2.5 and Hibernate 3 throwing exception

    Hi All,

    I have a simple Java application with Spring 2.5 and Hibernate 3. I am using c3p0 for managing the connection pool.
    I am using Oracle 11g as the database.

    On running the application, I am getting the following error.

    Code:
    com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1 com.mchange.v2.resourcepool.BasicResourcePool   An exception occurred while acquiring a poolable resource. Will retry.
    java.sql.SQLException: Unsupported feature
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
            at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689)
            at oracle.jdbc.driver.OracleConnection.getHoldability(OracleConnection.java:3085)
            at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnection.java:106)
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:198)
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
            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)

    Below is my config beans
    Code:
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    		<property name="driverClass" value="oracle.jdbc.OracleDriver" />
    		<property name="maxPoolSize" value="10" />
    		<property name="acquireIncrement" value="3" />
    		<property name="acquireRetryAttempts" value="0" />
    		<property name="acquireRetryDelay" value="5000" />
    		<property name="maxIdleTime" value="120" />
    		<property name="jdbcUrl" value="jdbc:oracle:thin:@myDB:16001:mySer" />
    		<property name="user" value="hello" />
    		<property name="password" value="world" />
    	</bean>
    
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	    <property name="mappingResources">
    			<list>
    				<value>hibernate/TherapeuticBrand.hbm.xml</value>
    			</list>
    		</property>
    		
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
    				<!--<prop key="hibernate.default_schema" value="SYSTEM"/>-->
    			</props>	
    		</property>
    	</bean>
    
    	<!-- THE HIBERNATE INTERCEPTOR -->
    	<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="transactionSynchronizationName" value="SYNCHRONIZATION_NEVER" />
    	</bean>
    
    	<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
    		<property name="transactionManager" ref="txManager"/>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="create*">PROPAGATION_REQUIRES_NEW</prop>
    				<prop key="update*">PROPAGATION_REQUIRES_NEW</prop>
    				<prop key="save*">PROPAGATION_REQUIRES_NEW</prop>
    				<prop key="delete*">PROPAGATION_REQUIRES_NEW</prop>
    				<prop key="clear*">PROPAGATION_REQUIRES_NEW</prop>
    				<prop key="*">PROPAGATION_SUPPORTS,ISOLATION_READ_UNCOMMITTED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
    
    	<bean id="txDefinition" class="org.springframework.aop.framework.ProxyFactoryBean" abstract="true">
    		<property name="proxyTargetClass" value="true" />
    		<property name="singleton" value="true" />
    		<property name="interceptorNames">
    			<list>
    				<value>txInterceptor</value>
    			</list>
    		</property>
    	</bean>

    What am I missing here ??

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    There is currently no relation between your configured datasource and hibernate, it isn't injected so basically your datasource definition is useless. The same goes for your transactionmanager, there is no relation with the sessionfactory. (Unless you rely on autowiring, which is not something recommended in general).

    Can you post the fullstacktrace, there seems/should be more to this...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    That is the only stack trace..
    It keeps putting the same thing again and again... Like an infinite loop.....

    I waited 10 mins for it to get over.... still didnt get over.... and I had to terminate the process...

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Hmm strange... There must be something else wrong, I used C3P0 in many projects without any problems. You must be doing something weird, or calling/using somefunctionality which isn't supported by the Oracle JDBC driver. Have you tried a newer/older version of the oracle jdbc driver?
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5

    Default

    Have you tried a newer/older version of the oracle jdbc driver?
    I didnt get what you meant by this ?

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Well just as I stated. You are using Oracle as a database so you are also using the oracle jdbc driver, try a newer version...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  7. #7

    Thumbs up Resolved

    Thanks Marten....

    I was indeed using an old driver.... in fact I had the classes12.jar in the classpath instead of ojdbc14.jar... Also I changed the driver class in the datasource bean to oracle.jdbc.driver.OracleDriver ....

    Thanks....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •