I'm having a problem with enabling c3po connection pooling with hibernate. I'm using hibernate 3.2.1.sp1 and c3po-0.9.1.jar. My context is a junit 3.8.1 test suite running inside of MyEclipse 5.1 w/ jdk 1.5. My db is oracle 8.1.
My junit test works fine.
Until I attempt to specify a simple c3po connection pool inside my hibernate.cfg.xml file. If I add that, I get the following exception:
Code:
.
.
.
2266 [main] DEBUG org.hibernate.cfg.Configuration - resolving reference to class: com.objectresourcegroup.hibernate.Courtplan
2369 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@smaug:1521:cprs2
2369 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - Connection properties: {user=cprs2, password=****}
2369 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - autocommit mode: false
2393 [main] INFO com.mchange.v2.log.MLog - MLog clients using log4j logging.
E
Time: 2.452
There was 1 error:
1) junit.framework.TestSuite@823918java.lang.NoClassDefFoundError: org/jboss/mx/util/PropertyAccess
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:202)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:153)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:147)
at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:264)
at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:512)
at com.mchange.v2.c3p0.management.ActiveManagementCoordinator.<init>(ActiveManagementCoordinator.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.mchange.v2.c3p0.C3P0Registry.<clinit>(C3P0Registry.java:134)
at com.mchange.v2.c3p0.impl.DriverManagerDataSourceBase.<init>(DriverManagerDataSourceBase.java:206)
at com.mchange.v2.c3p0.DriverManagerDataSource.<init>(DriverManagerDataSource.java:60)
at com.mchange.v2.c3p0.DriverManagerDataSource.<init>(DriverManagerDataSource.java:56)
at com.mchange.v2.c3p0.DataSources.unpooledDataSource(DataSources.java:152)
at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:154)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at com.org.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:60)
at com.org.hibernate.HibernateSessionFactory.getSession(HibernateSessionFactory.java:43)
at com.org.hibernate.junit.HibernateTestSuiteSetup.setUp(HibernateTestSuiteSetup.java:31)
at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at com.objectresourcegroup.hibernate.junit.CountyHibernateTest.main(CountyHibernateTest.java:36)
I have no idea why I'm getting an exception on a jboss/jmx PropertyAccess class not found. I'm not using boss at all. I tried to add the jboss-jmx.jar file to my classpath, but that did not fix the problem either.
Any ideas?
Here's my config file:
Code:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">cprs2</property>
<property name="hibernate.connection.url"> jdbc:oracle:thin:@smaug:1521:cprs2 </property>
<property name="hibernate.dialect"> org.hibernate.dialect.OracleDialect </property>
<property name="hibernate.connection.password">****</property>
<property name="hibernate.connection.driver_class"> oracle.jdbc.driver.OracleDriver </property>
<!-- configuration pool via c3p0 -->
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.timeout">100</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<!-- hibernate mapping files -->
<mapping resource="com/org/hibernate/Courtplan.hbm.xml" />
</session-factory>
</hibernate-configuration>
/>