Announcement Announcement Module
Collapse
No announcement yet.
Error:configure c3p0 under spring! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error:configure c3p0 under spring!

    I want to use c3p0 in spring,so I use following configure:
    applicationContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?> 
    <beans 
       xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> 
      <bean id="dataSource" 
            class="com.mchange.v2.c3p0.ComboPooledDataSource" 
            destroy-method="close"> 
            <property name="driverClass"><value>oracle.jdbc.driver.OracleDriver</value></property> 
            <property name="jdbcUrl"><value>jdbc:oracle:thin:@localhost:1521:orcl</value> </property> 
            <property name="user"><value>scott</value> </property> 
            <property name="password"><value>tiger</value></property> 
            <property name="minPoolSize"> <value>10</value></property> 
            <property name="maxPoolSize"><value>20</value> </property> 
            <property name="initialPoolSize"> <value>10</value> </property> 
        </bean> 
        <bean id="sessionFactory" 
            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
            <property name="dataSource"> 
                <ref bean="dataSource"></ref> 
            </property> 
            <property name="hibernateProperties"> 
                <props> 
                    <prop key="hibernate.dialect"> 
                        org.hibernate.dialect.OracleDialect 
                    </prop> 
                    <prop key="hibernate.show_sql"> 
                        false 
                    </prop> 
                    <prop key="hibernate.generate_statistics">true</prop> 
                    <prop key="hibernate.cache.use_query_cache"> 
                        true 
                    </prop> 
                    <prop key="hibernate.cache.use_second_level_cache"> 
                        true 
                    </prop> 
                    <prop key="hibernate.cache.provider_class"> 
                        net.sf.ehcache.hibernate.EhCacheProvider 
                    </prop> 
                    <prop key="hibernate.connection.provider_class"> 
                        org.hibernate.connection.C3P0ConnectionProvider 
                    </prop> 
                    <prop key="hibernate.query.substitutions"> 
                        true 1, false 0, yes 'Y', no 'N' 
                    </prop> 
                    <prop 
                        key="hibernate.bytecode.use_reflection_optimizer"> 
                        true 
                    </prop> 
                    <prop key="hibernate.use_outer_join">true</prop> 
                    <prop key="hibernate.prepare_sql">true</prop> 
                    <prop key="hibernate.query.factory_class"> 
                        org.hibernate.hql.ast.ASTQueryTranslatorFactory 
                    </prop> 
                </props> 
            </property> 
            <property name="mappingResources"> 
                <list> 
                    <value>events/Event.hbm.xml</value> 
                </list> 
            </property> 
        </bean> 
       </beans>
    Event.java
    Code:
    import java.util.Date; 
    public class Event { 
       private Long id; 
       private String title; 
       private Date date; 
       public Event() {} 
       public Long getId() { 
          return id; 
       } 
       private void setId(Long id) { 
          this.id = id; 
       } 
       public Date getDate() { 
          return date; 
       } 
       public void setDate(Date date) { 
          this.date = date; 
       } 
       public String getTitle() { 
          return title; 
       } 
       public void setTitle(String title) { 
          this.title = title; 
       } 
    }
    Event.hbm.xml
    Code:
    <?xml version="1.0"?> 
    <!DOCTYPE hibernate-mapping PUBLIC 
       "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 
    <hibernate-mapping> 
       <class name="events.Event" table="EVENTS"> 
          <id name="id" column="EVENT_ID"> 
             <generator class="native"/> 
          </id> 
          <property name="date" type="timestamp" column="EVENT_DATE"/> 
          <property name="title"/> 
       </class> 
    </hibernate-mapping>
    Oracle database table:
    Code:
    create table EVENTS 
    ( 
      EVENT_ID   NUMBER(19) not null, 
      EVENT_DATE TIMESTAMP(6), 
      TITLE      VARCHAR2(255 CHAR) 
    )
    when tomcat starts,it raise following error:
    Code:
    Info: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null,connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName-> 1hgeqtb7og3i34y1qar468|cd2e33, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgeqtb7og3i34y1qar468|cd2e33, idleConnectionTestPeriod -> 0, initialPoolSize -> 10, jdbcUrl -> jdbc:oracle:thin:@localhost:1521:orcl, maxAdministrativeTaskT 
    ime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections 
    -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, mi 
    nPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 
     0, preferredTestQuery -> null, properties -> {user=******, password=******}, pr 
    opertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> 
    false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> fal 
    se ] 
    2007-8-6 15:12:04 com.mchange.v2.c3p0.impl.NewPooledConnection carefulCheckHolda 
    bility 
    Warn: oracle.jdbc.driver.OracleConnection@1eb904d threw an Error when we tried t 
    o check its default holdability. This is probably due to a bug in your JDBC driv 
    er that c3p0 can harmlessly work around (reported for some DB2 drivers). Please 
    verify that the error stack trace is consistentwith the getHoldability() method 
    not being properly implemented, and is not due to some deeper problem. This mess 
    age will not be repeated for Connections of type oracle.jdbc.driver.OracleConnec 
    tion that provoke errors of type java.lang.AbstractMethodError when getHoldabili 
    ty() is called. 
    java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.getHoldabilit 
    y()I 
            at com.mchange.v2.c3p0.impl.NewPooledConnection.carefulCheckHoldability( 
    NewPooledConnection.java:117) 
            at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnecti 
    on.java:109) 
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
    on(WrapperConnectionPoolDataSource.java:198) 
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
    on(WrapperConnectionPoolDataSource.java:171) 
            at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe 
    sourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 
            at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResource 
    Pool.java:1007) 
            at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourc 
    ePool.java:32) 
            at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicRe 
    sourcePool.java:1783) 
            at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(Thre 
    adPoolAsynchronousRunner.java:547) 
    Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThrea 
    d-#1" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.getType 
    Map()Ljava/util/Map; 
            at com.mchange.v2.c3p0.impl.NewPooledConnection.carefulCheckTypeMap(NewP 
    ooledConnection.java:173) 
            at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnecti 
    on.java:111) 
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
    on(WrapperConnectionPoolDataSource.java:198) 
            at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnecti 
    on(WrapperConnectionPoolDataSource.java:171) 
            at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionRe 
    sourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 
            at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResource Pool.java:1007) 
            at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourc ePool.java:32) 
            at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1783) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 
    Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.getTypeMap()Ljava/util/Map;
            at com.mchange.v2.c3p0.impl.NewPooledConnection.carefulCheckTypeMap(NewPooledConnection.java:173) 
            at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnection.java:111) 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:1007) 
            at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    Why raise above error? I have puzzled with above errors for one week! Anyone could tell me where I am wrong and how to solve it?

    Thanks in advance!

  • #2
    It's not an error, it's a warning. I don't really know anything about the Oracle driver, but I'm sure the Oracle forums probably have threads on this issue. I'd guess the method simply isn't implemented hence the message.
    Warn: oracle.jdbc.driver.OracleConnection@1eb904d threw an Error when we tried to check its default holdability. This is probably due to a bug in your JDBC driver that c3p0 can harmlessly work around (reported for some DB2 drivers). Please verify that the error stack trace is consistentwith the getHoldability() method not being properly implemented, and is not due to some deeper problem. This message will not be repeated for Connections of type oracle.jdbc.driver.OracleConnection that provoke errors of type java.lang.AbstractMethodError when getHoldability() is called.
    Last edited by karldmoore; Aug 27th, 2007, 03:58 PM.

    Comment

    Working...
    X