-->
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.  [ 4 posts ] 
Author Message
 Post subject: InvocationTargetException in session.createQuery("from
PostPosted: Mon Jan 02, 2006 3:43 pm 
Newbie

Joined: Mon Jan 02, 2006 3:22 pm
Posts: 4
Hallo everbody,

I'm new to Hibernate and I am trying to run the example (chapter 1) of the reference documentation (Events, Persons, ...).

Unfortunately there seems to be a big problem while using the line of code
Code:
List result = session.createQuery("from Event").list();


The following Exception ist thrown:
Code:
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
   at $Proxy0.createQuery(Unknown Source)
   at events.EventManager.listEvents(EventManager.java:79)
   at events.EventManager.main(EventManager.java:18)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   ... 3 more
Caused by: java.lang.NoClassDefFoundError: antlr/ANTLRException
   at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:31)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:71)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)
   ... 8 more


Hibernate version:
3.1

Mapping documents:
Indentical to introductory example printed in chapter 1 of the reference doc.

Code between sessionFactory.openSession() and session.close():
indentical to the introduction (chapter 1 of reference doc)

The Problem occurs using Java 5.0 and JDK 1.4.

I have checked everything very carfully and the forum doesn't seem to offer o document addressing this problem. So, please, could someone give me a hint, what to do?

Thanks in advance

Peter[/b][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 4:57 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

I think you have not added the required jars for Hibernate in the BUILD PATH. eg) antlr.jar

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Tue Jan 03, 2006 6:12 am 
Newbie

Joined: Mon Jan 02, 2006 3:22 pm
Posts: 4
Hi Ramnath,

thank you for your hint. Well, yes, my problem was caused by missing libraries. Let me explain:

I used all the JARs that were requested by the tutorial (see part 1.2 of the reference doc):
Code:
antlr.jar
  cglib.jar
  asm.jar
  asm-attrs.jars
  commons-collections.jar
  commons-logging.jar
  hibernate3.jar
  jta.jar
  dom4j.jar
  log4j.jar

So, antlr.jar was never missing. As a result of your suggestion I have linked all JARs that come with hibernate and now it works.

So, maybe there are some inconsistencies between the documentation (chapter 1) and the software.

Thanks and a happy new year!

Peter


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 6:15 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Peter don't forget to give credit.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.