-->
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.  [ 2 posts ] 
Author Message
 Post subject: Exception in thread "main" java.lang.NoSuchFieldEr
PostPosted: Fri Jul 06, 2007 5:02 am 
Newbie

Joined: Fri Jul 06, 2007 2:43 am
Posts: 1
Hi All,

I am using Hibernate3.2,MySql 4.14 and Tomcat server for my application.

under Lib directory i have placed following jar files..
-------------------------------------------------------------
hibernate3.jar,jta.jar,antlr-2.7.6.jar,asm.jar,asm-attrs.jar,cglib-2.1.3.jar,commons-collections-2.1.1.jar,commons-logging-1.0.4.jar,dom4j-1.6.1.jar,log4j-1.2.11.jar
-------------------------------------------------------------------

Here is My program
-------------------

code:
--------------------------------------------------------------------------------

import org.hibernate.*;
import org.hibernate.Session;
import org.hibernate.cfg.*;
import java.util.*;
public class SelectHQLExample { public static void main(String[] args) {
Session session = null; try{
// This step will read hibernate.cfg.xml and prepare hibernate for use SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
//Using from Clause
String SQL_QUERY ="from Insurance";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext()
{ Insurance insurance=(Insurance)it.next(); System.out.println("ID: " + insurance.getLngInsuranceId()); System.out.println("First Name: " + insurance.getInsuranceName());
}
session.close(); }
catch(Exception e){ System.out.println(e.getMessage()); }
finally{ }
}
}

--------------------------------------------------------------------------------


---------------------------------------
When i run the above program the following error i am getting,please help to solve this issue..
----------------------------------------

Exception in thread "main" java.lang.NoSuchFieldError: tokenTypeToASTClassMap
at org.hibernate.hql.antlr.HqlBaseParser.buildTokenTypeASTClassMap(HqlBaseParser.java:4559)
at org.hibernate.hql.antlr.HqlBaseParser.<init>(HqlBaseParser.java:116)
at org.hibernate.hql.antlr.HqlBaseParser.<init>(HqlBaseParser.java:121)
at org.hibernate.hql.ast.HqlParser.<init>(HqlParser.java:49)
at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:45)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:242)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at SelectHQLExample.main(SelectHQLExample.java:20)

---------------------------------

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 8:14 am 
Beginner
Beginner

Joined: Mon Nov 13, 2006 9:43 am
Posts: 30
Hi,

your exception says that we you should deliver a little bit more info to let forum help you... :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.