-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: org/hibernate/cfg/SecondPass not found
PostPosted: Wed Jan 25, 2006 3:02 am 
Newbie

Joined: Mon Dec 26, 2005 6:55 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1
Hibernate Annotations version: 3.1 beta8

Mapping documents: Annotations

Full stack trace of any exception that occurs:
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hiber
nate/cfg/SecondPass
Exception in thread "main" java.lang.ExceptionInInitializerError
at hsbc.hibernatestart.HibernateUtil.<clinit>(HibernateUtil.java:20)
at hsbc.hibernatestart.EventManager.store(EventManager.java:50)
at hsbc.hibernatestart.EventManager.main(EventManager.java:20)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/SecondPass
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(Anno
tationConfiguration.java:270)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(Annotatio
nConfiguration.java:210)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1036)
at hsbc.hibernatestart.HibernateUtil.<clinit>(HibernateUtil.java:15)
... 2 more

I had seen the hibernate-annotations.jar(3.1 beta8) after unzipping it, which has a reference to org/hibernate/cfg/SecondPass but this class is not present in the jar.

I searched SecondPass.class & found it in hibernate-annotations.jar(3.1 beta4) but adding this file is again giving the error.


Name and version of the database you are using: hsqldb 1.8.0

Here is the code for creation of Session Factory
sessionFactory = new AnnotationConfiguration().addAnnotatedClass(Event.class).buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 9:14 am 
Newbie

Joined: Mon Jan 23, 2006 1:11 pm
Posts: 15
Location: Leuven, Belgium
I've got the feeling you don't have the hibernate3.jar package in your classpath...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 2:21 pm 
Newbie

Joined: Thu Sep 08, 2005 12:37 pm
Posts: 10
I've got the same problem with the AntHibernateToolTask and I have my hibernate3.jar in the classpath (H 3.1.1 as pointed out by the current Hibernate Annotation Reference Documentation).

Oliver-Arne


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 3:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Version older than 3.1beta3 had not the class

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 3:43 pm 
Newbie

Joined: Thu Sep 08, 2005 12:37 pm
Posts: 10
OK.

My fault. My classpath contains the version of H 3.1 core not the intendend and earlier mentioned H 3.1.1 core. After replacing with the current version, everything works as expected both within Ant runs and with the AnnotatedConfiguration in my application.

Oliver-Arne


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 26, 2006 12:43 am 
Newbie

Joined: Mon Dec 26, 2005 6:55 am
Posts: 2
Thanks I downloaded the latest hibernate3.1.1 & added the jar file & it is fixed.

But now it is giving Initial SessionFactory creation failed.org.hibernate.HibernateException: Hibernate Dialect must be explicitly set


Code:
Initial SessionFactory creation failed.org.hibernate.HibernateException: Hiberna
te Dialect must be explicitly set
Exception in thread "main" java.lang.ExceptionInInitializerError
        at hsbc.hibernatestart.HibernateUtil.<clinit>(HibernateUtil.java:20)
        at hsbc.hibernatestart.EventManager.store(EventManager.java:50)
        at hsbc.hibernatestart.EventManager.main(EventManager.java:20)
Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitl
y set
        at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.
java:57)
        at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java
:39)
        at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.ja
va:378)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
110)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1869
)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1162)
        at hsbc.hibernatestart.HibernateUtil.<clinit>(HibernateUtil.java:15)
        ... 2 more


My hibernate.cfg.xml file is
Code:
<hibernate-configuration>

    <session-factory>
        <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
        <property name="connection.url">jdbc:hsqldb:data/test</property>
        <property name="connection.username">sa</property>
        <property name="connection.password"></property>
        <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
        <property name="show_sql">true</property>
        <property name="transaction.factory_class">
             org.hibernate.transaction.JDBCTransactionFactory
        </property>
        <property name="cache.provider_class">
             org.hibernate.cache.HashtableCacheProvider
        </property>
        <property name="hbm2ddl.auto">update</property>

        <!--<mapping resource="hsbc/hibernatestart/Event.hbm.xml"/>-->
        <mapping class="hsbc.hibernatestart.Event"/>

    </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 26, 2006 6:51 am 
Newbie

Joined: Mon Jan 23, 2006 1:11 pm
Posts: 15
Location: Leuven, Belgium
There is a reason for the existence of the documentation...

Code:
AnnotationConfiguration cfg = new AnnotationConfiguration();
cfg.configure("hibernate.cfg.xml");
cfg.addAnnotatedClass(Event.class);
sessionFactory = cfg.buildSessionFactory();

_________________
Don't applaud, throw money (paypal to timvw@users.sourceforge.net) - http://www.timvw.be


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.