I am trying first hibernate application from tutorial. It works for hibernate 2.0 but it doest not work with hibernate 3.0.
private List listEvents() {
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
List result = session.createQuery("from Event").list();
tx.commit();
session.close();
return result;
}
It is throwing following exception.
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoClassDefFoundError: antlr/ANTLRException
at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:31)
at org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:410)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:469)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1032)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1068)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41)
at src.EventManager.listEvents(EventManager.java:55)
at src.EventManager.main(EventManager.java:21)
Exception in thread "main"
It's hard to say, as you don't provide the actual line number that it is failing on. But, from the looks of things, you probably don't have a required jar file in your classpath.