Hi,
I am a newbie to hibernate. please help me out with this error ASAP.
Oct 29, 2010 9:38:19 AM org.hibernate.cfg.annotations.Version <clinit> INFO: Hibernate Annotations 3.2.0.GA Oct 29, 2010 9:38:19 AM org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.0.3 Oct 29, 2010 9:38:19 AM org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found Oct 29, 2010 9:38:19 AM org.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer Oct 29, 2010 9:38:19 AM org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling
Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org/hibernate/cfg/AnnotationConfiguration.configure()Lorg/hibernate/cfg/AnnotationConfiguration; Exception in thread "main" java.lang.ExceptionInInitializerError at org.subreg.utilities.HibernateUtil.<clinit>(HibernateUtil.java:15) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:194) at org.subreg.hibernate.Main.main(Main.java:11) Caused by: java.lang.NoSuchMethodError: org/hibernate/cfg/AnnotationConfiguration.configure()Lorg/hibernate/cfg/AnnotationConfiguration; at org.subreg.utilities.HibernateUtil.<clinit>(HibernateUtil.java:11) ... 3 more
These are the library files used
hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\hibernate3.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\antlr-2.7.6.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\commons-collections-3.1.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\dom4j-1.6.1.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\javassist-3.9.0.GA.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\jta-1.1.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\required\slf4j-api-1.5.8.jar hibernate-distribution-3.3.2.GA-dist\hibernate-distribution-3.3.2.GA\lib\bytecode\cglib\cglib-2.2.jar hibernate-annotations-3.4.0.GA\hibernate-annotations-3.4.0.GA\hibernate-annotations.jar hibernate-annotations-3.4.0.GA\hibernate-annotations-3.4.0.GA\lib\ejb3-persistence.jar hibernate-annotations-3.4.0.GA\hibernate-annotations-3.4.0.GA\lib\hibernate-commons-annotations.jar hibernate-annotations-3.4.0.GA\hibernate-annotations-3.4.0.GA\lib\test\slf4j-log4j12.jar hibernate-annotations-3.4.0.GA\hibernate-annotations-3.4.0.GA\lib\test\log4j.jar
This is the hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration> <session-factory name="java:hibernate/SessionFactory"> <property name="connection.datasource">java:/comp/env/jdbc/Dev</property> <property name="transaction.factory_class"> org.hibernate.transaction.JTATransactionFactory </property> <property name="connection.pool_size">1</property> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <property name="show_sql">true</property> <mapping class="org.subreg.hibernate.StudyConfig"/> </session-factory> </hibernate-configuration>
This is the util class used
import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration;
public class HibernateUtil {
private static final SessionFactory sessionFactory; static { try { sessionFactory = new AnnotationConfiguration().configure() .buildSessionFactory(); }catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
|