简体   繁体   中英

Hibernate c3p0 initialization error

After my project is deployed a few times, I get this log and it just pauses there. I have to re-run my project afterwards. How can I solve this and prevent in future?

Info:   Initializing c3p0-0.9.2-pre2 [built 18-May-2012 10:14:10 -0400; debug? true; trace: 10]

Warning:   A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources.

Info:   Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f63e045c [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@7aab8919 [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge13c9f3qzb1d180wvxe|f1928e0, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@3a5a11 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hge13c9f3qzb1d180wvxe|1311a587, jdbcUrl -> jdbc:mysql://192.168.1.13:3306/medi_soft?autoReconnect=true, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hge13c9f3qzb1d180wvxe|79fef582, numHelperThreads -> 3 ]



    <!-- c3p0 Connection Pool Properties -->
    <property name="hibernate.connection.pool_size">1</property>
    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">100</property> 
    <property name="hibernate.c3p0.timeout">0</property>
    <property name="hibernate.c3p0.max_statements">0</property>
    <property name="hibernate.c3p0.idle_test_period">0</property>

From the info log, it seems that you are using JMX server/JMX MBeanServer. Use JMX tool bundled with JDK, such as Jconsole to edit the datasource's configuration properties. You will find that c3p0 registers MBeans under the domain com.mchange.v2.c3p0 and an MBean for each PooledDataSource you deploy.

If you do not explicitly set a RegistryName, then full JMX ObjectName would be

com.mchange.v2.c3p0:type=C3P0Registry.

The above value is default and hibernate/application is trying to initialize c3p0 with the same registry bean(default).

Please set the registry in your config/properties file. For eg:

com.mchange.v2.c3p0:type=C3P0Registry,name=C3P0Registrynew

If the above solution does not work, disable JMX support. System property to disable JMX support is:

com.mchange.v2.c3p0.management.ManagementCoordinator=com.mchange.v2.c3p0.management.NullManagementCoordinator

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM