2014-02-07 3 views
0

최대 절전 모드 3.3을 사용 중이고 C3P0이 번들로 제공된다는 사실을 알게되었습니다. 하지만 hibernate.cfg.xml에 C3P0 속성 설정을 추가 한 후에 클래스에 클래스 예외가 콘솔에 나타나면 내 클래스 경로에 c3p0-0.9.1.jar을 다운로드하고 추가하여 C3P0이 작동하기 시작했습니다. 이제최대 절전 모드 C3P0 unreturnedConnectionTimeout 및 debugUnreturnedConnectionStackTraces가 작동하지 않음

내가 Eclipse를 사용하여 내있는 hibernate.cfg.xml에 선 아래로 추가 오전 :

<property name="hibernate.c3p0. 

인텔리 나만을 보여주는 : 그것은 나를 에게 unreturnedConnectionTimeoutdebugUnreturnedConnectionStackTraces을 보여주는 아니에요

hibernate.c3p0.acquire_increment 
hibernate.c3p0.idle_test_period 
hibernate.c3p0.max_size 
hibernate.c3p0.max_statements 
hibernate.c3p0.min_size 
hibernate.c3p0.timeout 

속성, 여전히 나는이 두 줄을 붙여 넣었고 효과가 없습니다. 언제든지 서버 로그에 debugUnreturnedConnectionStackTraces가 표시되지 않습니다.

<hibernate-configuration> 
<session-factory> 
<property name="hibernate.c3p0.unreturnedConnectionTimeout">40</property> 
<property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property> 
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property> 
    <property name="hibernate.connection.url">jdbc:oracle:thin:@xyz:1521:sid</property> 
    <property name="hibernate.connection.username">abc</property> 
    <property name="hibernate.connection.password">123</property> 
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> 
    <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> 

    <property name="hibernate.c3p0.min_size">5</property> 
    <property name="hibernate.c3p0.max_size">30</property> 
    <property name="hibernate.c3p0.timeout">20</property> 
    <property name="hibernate.c3p0.max_statements">50</property> 
    <property name="hibernate.c3p0.idle_test_period">3000</property> 

    <property name="hibernate.c3p0.unreturnedConnectionTimeout">40</property> 
    <property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property> 
</session-factory> 

</hibernate-configuration> 

정보 수준 덤프 등 :

INFO [org.hibernate.validator.Version] (http--0.0.0.0-8081-3) Hibernate Validator 3.1.0.GA 
INFO [org.hibernate.connection.ConnectionProviderFactory] (http--0.0.0.0-8081-3) Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider 
INFO [org.hibernate.connection.C3P0ConnectionProvider] (http--0.0.0.0-8081-3) C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbcracle:thinxyz:1521:abc 
INFO [org.hibernate.connection.C3P0ConnectionProvider] (http--0.0.0.0-8081-3) Connection properties: {user=abcd, password=****, release_mode=after_statement} 
INFO [org.hibernate.connection.C3P0ConnectionProvider] (http--0.0.0.0-8081-3) autocommit mode: false 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) RDBMS: Oracle, version: Oracle Database 11g Release 11.1.0.0.0 - Production 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) JDBC driver: Oracle JDBC driver, version: 10.2.0.5.0 
INFO [org.hibernate.dialect.Dialect] (http--0.0.0.0-8081-3) Using dialect: org.hibernate.dialect.Oracle9Dialect 
WARN [org.hibernate.dialect.Oracle9Dialect] (http--0.0.0.0-8081-3) The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead 
INFO [org.hibernate.transaction.TransactionFactoryFactory] (http--0.0.0.0-8081-3) Using default transaction strategy (direct JDBC transactions) 
INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (http--0.0.0.0-8081-3) No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Automatic flush during beforeCompletion(): disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Automatic session close at end of transaction: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) JDBC batch size: 15 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) JDBC batch updates for versioned data: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Scrollable result sets: enabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) JDBC3 getGeneratedKeys(): disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Connection release mode: after_statement 
WARN [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Overriding release mode as connection provider does not support 'after_statement' 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Default batch fetch size: 1 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Generate SQL with comments: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Order SQL updates by primary key: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Order SQL inserts for batching: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 
INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] (http--0.0.0.0-8081-3) Using ASTQueryTranslatorFactory 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Query language substitutions: {} 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) JPA-QL strict compliance: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Second-level cache: enabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Query cache: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Optimize cache for minimal puts: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Structured second-level cache entries: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Statistics: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Deleted entity synthetic identifier rollback: disabled 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Default entity-mode: pojo 
INFO [org.hibernate.cfg.SettingsFactory] (http--0.0.0.0-8081-3) Named query checking : enabled 
INFO [org.hibernate.impl.SessionFactoryImpl] (http--0.0.0.0-8081-3) building session factory 
INFO [org.hibernate.impl.SessionFactoryObjectFactory] (http--0.0.0.0-8081-3) Not binding factory to JNDI, no JNDI name configured 

com.mchange 로그 : ERROR에서

DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.dialect=org.hibernate.dialect.Oracle9Dialect 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.url=jdbc:oracle:thin:@abcd:1521:xyz 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.username=yyy 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.password=xxx 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.connection.release_mode=after_statement 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.min_size=5 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.max_size=30 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.timeout=20 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.max_statements=50 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.idle_test_period=3000 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.unreturnedConnectionTimeout=40 
DEBUG [org.hibernate.cfg.Configuration] (http--0.0.0.0-8081-1) hibernate.c3p0.debugUnreturnedConnectionStackTraces=true 

com.mchange 로그 아래

내있는 hibernate.cfg.xml입니다 수준 :

ERROR [org.hibernate.util.JDBCExceptionReporter] (http--0.0.0.0-8081-1) [email protected] [ connectionPoolDataSource -> [email protected] [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> true, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 31l7yg907o7aar1ysxqrk|22915056, idleConnectionTestPeriod -> 3000, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> [email protected]  [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 31l7yg907o7aar1ysxqrk|58363f95, jdbcUrl -> jdbc:oracle:thin:@cFRO:1521:ivfrt, properties -> {user=******, password=******, release_mode=after_statement} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 40, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 31l7yg907o7aar1ysxqrk|301c2c35, numHelperThreads -> 3 ] has been closed() -- you can no longer use it. 
TRACE [org.jboss.modules] (http--0.0.0.0-8081-8) Attempting to find resource frro/daos/administration/ in Module "deployment.appname.war:main" from Service Module Loader 
ERROR [stderr] (http--0.0.0.0-8081-1) Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability. 

답변

1

아마도 뉴스가 좋으며 응용 프로그램에 연결 유출이 없습니다. 이러한 설정은 연결이 체크 아웃 된 경우에만 눈에 띄는 효과가 있지만 때로는 다시 체크인하지 않는 경우가 있습니다. 절대로 쓰지 않는 잘 작성된 응용 프로그램에서.

설정이 "복용 중"인지 확인하십시오. c3p0은 풀 초기화시 INFO에 설정을 덤프합니다. unreturnedConnectionTimeoutdebugUnreturnedConnectionStackTraces이 예상 한 값을 가지고 있는지 확인하십시오.

c3p0 0.9.1.x는 매우 오래되었습니다. 적어도 0.9.2.1 또는 0.9.5의 최신판으로 업그레이드하십시오.

연결 누수를 디버깅했거나 아무 것도없는 것으로 확인되면 debugUnreturnedConnectionStackTraces을 사용 중지하여 중요한 성능 드래그를 만듭니다.

+0

정보 추가 C3P0 초기화 jboss에서 덤프하여 내 질문에 로그를 보내고 unreturnedConnectionTimeout과 같은 키워드를 가져 오지 못하나요? 감사합니다. –

+0

안녕하세요. INFO에서도 com.mchange. * log를 시작하는 로거를 허용하도록 구성하십시오. 그것이 c3p0가 사는 곳입니다. org.hibernate. * 만 있습니다. –

+0

스티브 감사합니다. 좀 도와 주실 수 있습니다, 어떻게 com.mchange. * log를 INFO에 추가 하시겠습니까? com.mchange. * 로그를 얻으려면 내 hibernate.cfg.xml에 더 추가해야 할 것. jboss를 서버로 사용하고 있습니다. –