The moose likes Object Relational Mapping and the fly likes New to hibernate .Error in executing my first program Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "New to hibernate .Error in executing my first program" Watch "New to hibernate .Error in executing my first program" New topic
Author

New to hibernate .Error in executing my first program

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 120
Hi All,

Here is compilation error that i am geeting.please solve my problem
i am using Hibernate 3.1 rc2

Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheE
xception
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory
.java:327)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
219)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1823
)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1143)
at FirstExample.main(FirstExample.java:22)
Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6718

Can you post your hibernate.cfg.xml? Looks like it contains reference to the earlier version of EHCache.


[My Blog] [JavaRanch Journal]
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 120
Hi Jai,

here is the hibernate configuration file

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/hibernatetutorial</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6718

Interesting, the hibernate.cfg.xml doesnt have any reference to the cache provider. But the exception stacktrace shows that while the session factory is being built, the cache provider is being configured. Are you sure, this is the hibernate.cfg.xml that is being refered by Hibernate? Is there any hibernate.properties in your classpath, which might be containing references to the cache provider?
 
 
subject: New to hibernate .Error in executing my first program
 
Threads others viewed
error with hibernate3 and spring
ExceptionInInitializer Error
Identifiers
Error in running servlet
Ant 1.6.5
developer file tools