Hi folks,
my application ran well with Hibernate 3.1 RC3. Today I swapped 3 jar files in the lib folder (they are hibernate3.jar, antlr2.7.5h3 --> antlr2.7.6, ehcache-1.1 --> ehcache-1.2), the application broke down with such exceptions:
11:07:56,175 ERROR HibernateUtil:56 - Building SessionFactory failed.
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:346)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:220)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at test.HibernateUtil.<clinit>(HibernateUtil.java:50)
at test.UmfrageOMTest.<clinit>(UmfrageOMTest.java:20)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:220)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at test.HibernateUtil.<clinit>(HibernateUtil.java:50)
Here is the relevant code in my HibernateUtil.java:
Code:
static {
try {
configuration = new Configuration();
sessionFactory = configuration.configure().buildSessionFactory();
// We could also let Hibernate bind it to JNDI:
// configuration.configure().buildSessionFactory()
} catch (Throwable ex) {
// We have to catch Throwable, otherwise we will miss
// NoClassDefFoundError and other subclasses of Error
log.error("Building SessionFactory failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
I don't understand why it worked under Hibernate 3.1 rc 3 but broken down with the Hibernate 3.2.0 cr 2. Is there any change need to do in my configuration file? Here is the relevant code:
Code:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hibernate.connection.driver_class">
com.sap.dbtech.jdbc.DriverSapDB
</property>
<property name="hibernate.connection.url">
jdbc:sapdb://...
</property>
<property name="hibernate.connection.username">
...
</property>
<property name="hibernate.connection.password">...</property>
<!-- SQL dialect -->
<property name="hibernate.dialect">
org.hibernate.dialect.SAPDBDialect
</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="hibernate.connection.release_mode">
auto
</property>
<!-- Die Pfade zu den Mapping Dateien -->
<mapping resource="..." />
...
</session-factory>
</hibernate-configuration>
or did I miss any necessary jar file in the lib folder?
Any enlightenment would be highly appreciated! Many thanks in advance!
Regards,
Ellen