Hi,
I'm trying to run my first hibernate application but I'm stuck. My persistence.xml file looks like so:
Code:
<persistence-unit name="scholastic">
<properties>
<!-- Only scan and detect annotated entities -->
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<!-- Only scan and detect hbm.xml files
<property name="hibernate.archive.autodetection" value="hbm"/>
-->
<!-- SQL stdout logging
-->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="use_sql_comments" value="true"/>
<!-- We have a JTA data source... -->
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.url"
value="jdbc:hsqldb:hsql://localhost"/>
<property name="hibernate.connection.username"
value="sa"/>
<property name="hibernate.c3p0.min_size"
value="5"/>
<property name="hibernate.c3p0.max_size"
value="20"/>
<property name="hibernate.c3p0.timeout"
value="300"/>
<property name="hibernate.c3p0.max_statements"
value="50"/>
<property name="hibernate.c3p0.idle_test_period"
value="3000"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
</properties>
</persistence-unit>
</persistence>
Straight forward from what I can tell. Then when I actually run the app everything seems to be going good until I get to the line that says:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/PoolConfig
I don't know what that means, why it's even looking for this class, or where it's supposed to be. My console readout is as follows:
run:
[java] Hibernate EntityManager 3.2.1.GA
[java] Hibernate Annotations 3.2.1.GA
[java] Hibernate 3.2.1
[java] hibernate.properties not found
[java] Bytecode provider name : cglib
[java] using JDK 1.4 java.sql.Timestamp handling
[java] Binding entity from annotated class: scholastic.models.User
[java] Bind entity scholastic.models.User on table USERS
[java] Binding entity from annotated class: scholastic.models.Company
[java] Bind entity scholastic.models.Company on table COMPANIES
[java] Binding entity from annotated class: scholastic.models.Student
[java] Bind entity scholastic.models.Student on table STUDENTS
[java] Binding entity from annotated class: scholastic.models.Administrator
[java] Bind entity scholastic.models.Administrator on table ADMINISTRATORS
[java] Binding entity from annotated class: scholastic.models.Instructor
[java] Bind entity scholastic.models.Instructor on table INSTRUCTORS
[java] C3P0 using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://
localhost
[java] Connection properties: {user=sa, autocommit=true, release_mode=auto}
[java] autocommit mode: true
[java] Exception in thread "main" java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/PoolConfig
[java] at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:84)
[java] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
[java] at org.hibernate.ejb.InjectionSettingsFactory.createConnectionPr
ovider(InjectionSettingsFactory.java:29)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
[java] at org.hibernate.cfg.Configuration.buildSettingsConfiguration.java:2006)
[java] at org.hibernate.cfg.Configuration.buildSessionFactoryConfiguration.java:1289)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory
(Ejb3Configuration.java:713)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Pers
istence.java:51)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Pers
istence.java:33)
[java] at scholastic.models.Test.main(Unknown Source)
[java] Java Result: 1
What is going on? How do I fix it?
Please advise,
Alan