-->
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.  [ 3 posts ] 
Author Message
 Post subject: QueryException: ClassNotFoundException: hql.ast.HqlToken
PostPosted: Tue Jan 24, 2006 7:45 pm 
Hi:

Trying to get past NamedQuery Exception during initialization. Stack Traces and logs are after turning DEBUG on for the SessionImp class. The error is ClassNotFound. But the class it references which I believe is called by the antl is in the Hibernate3.jar.




Hibernate version: 3.1

Mapping documents:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE hibernate-mapping PUBLIC

"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.everware.component.unittest.person">
<class name="Person" table="Person">
<id column="InstanceID" name="instanceID" type="integer" unsaved-value="null">
<generator class="native" />
</id>
<property column="ID_FORMAT_CODE" insert="true" name="idFormatCode" not-null="false" type="string" unique="false" update="true" />
<property column="RELIGION_CODE" insert="true" name="religionCode" not-null="false" type="string" unique="false" update="true" />
<property column="OBSOLETE_IND" insert="true" name="obsoleteIndicator" not-null="false" type="string" unique="false" update="true" />
<property column="NICKNAME" insert="true" name="nickname" not-null="false" type="string" unique="false" update="true" />
<property column="CREATED_USERID" insert="true" name="createdUserID" not-null="true" type="string" unique="false" update="true" />
<property column="PREVIOUS_SURNAME" insert="true" name="previousSurname" not-null="false" type="string" unique="false" update="true" />
<property column="INCOME_AMT" insert="true" name="incomeAmount" not-null="false" type="double" unique="false" update="true" />
<property column="LANGUAGE_PREF_CODE" insert="true" name="languagePreferenceCode" not-null="false" type="string" unique="false" update="true" />
<property column="SURNAME" insert="true" name="surname" not-null="true" type="string" unique="false" update="true" />
<property column="FIRST_NAME" insert="true" name="firstName" not-null="true" type="string" unique="false" update="true" />
<property column="DATE_OF_BIRTH" insert="true" name="dateOfBirth" not-null="false" type="date" unique="false" update="true" />
<property column="salutation" insert="true" name="salutation" not-null="true" type="string" unique="false" update="true" />
<property column="ID_VALUE" insert="true" name="idValue" not-null="false" type="string" unique="false" update="true" />
<property column="MARITAL_STATUS_CODE" insert="true" name="maritalStatusCode" not-null="false" type="string" unique="false" update="true" />
<property column="LAST_UPDATED_TS" insert="true" name="lastUpdatedTimestamp" not-null="true" type="date" unique="false" update="true" />
<property column="DATE_OF_DEATH" insert="true" name="dateOfDeath" not-null="false" type="date" unique="false" update="true" />
<property column="GENDER_CODE" insert="true" name="genderCode" not-null="true" type="string" unique="false" update="true" />
<property column="CREATED_TS" insert="true" name="createdTimestamp" not-null="true" type="date" unique="false" update="true" />
<property column="ETHNICITY_CODE" insert="true" name="ethnicityCode" not-null="false" type="string" unique="false" update="true" />
<property column="LAST_UPDATED_USERID" insert="true" name="lastUpdatedUserID" not-null="true" type="string" unique="false" update="true" />
<property column="NAME_SUFFIX_CODE" insert="true" name="nameSuffixCode" not-null="false" type="string" unique="false" update="true" />
<property column="ID_Type_Code" insert="true" name="idTypeCode" not-null="false" type="string" unique="false" update="true" />
<property column="INCOME_FREQ_CODE" insert="true" name="incomeFrequencyCode" not-null="false" type="string" unique="false" update="true" />
<property column="MIDDLE_NAME" insert="true" name="middleName" not-null="false" type="string" unique="false" update="true" />
<property column="socialSecurityNum" insert="true" name="socialSecurityNum" not-null="false" type="string" unique="false" update="true" />
<set cascade="none" inverse="true" name="PersonStatuss">
<key column="InstanceID" />
<one-to-many class="com.everware.component.unittest.person.PersonStatus" />
</set>
<set cascade="none" inverse="true" name="Addresss">
<key column="InstanceID" />
<one-to-many class="com.everware.component.unittest.person.Address" />
</set>
<set cascade="none" inverse="true" name="Phones">
<key column="InstanceID" />
<one-to-many class="com.everware.component.unittest.person.Phone" />
</set>
</class>

<query name="findAllPersons"><![CDATA[from Person person]]></query>
<!--
<query name="findByGender"><![CDATA[from Person person where person.genderCode=:genderCode]]></query>
<query name="findByGenderASCSortByInstanceID"><![CDATA[from Person person where person.genderCode=:genderCode order by person.instanceID asc]]></query>
<query name="findByGenderDESCSortByInstanceID"><![CDATA[from Person personfrom Person person where person.genderCode=:genderCodefrom Person person where person.genderCode=:genderCode order by person.instanceID ascfrom Person person where person.genderCode=:genderCode order by person.instanceID desc]]></query>
<query name="findByGenderAndReligion"><![CDATA[from Person person where person.genderCode=:genderCode and person.religionCode = :religionCode]]></query>
<query name="findByGenderIDAndReligion"><![CDATA[from Person person where person.genderCode=:genderCode and person.instanceID = :instanceID and person.religionCode = :religionCode ]]></query>
<query name="findByIncomeAndGender"><![CDATA[from Person person where person.incomeAmount >= :incomeAmount and person.genderCode=:genderCode]]></query>
<query name="findByMiddleIncome"><![CDATA[from Person person where person.genderCode=:genderCode and person.religionCode = :religionCodefrom Person person where person.genderCode=:genderCode and person.instanceID = :instanceID and person.religionCode = :religionCode from Person person where person.incomeAmount >= :incomeAmount and person.genderCode=:genderCodefrom Person person where person.incomeAmount between :beginIncomeAmount and :endIncomeAmount]]></query>
<query name="findBySingleWomen"><![CDATA[from Person person where person.salutation in ('Ms.', 'Miss') ]]></query>
<query name="findByLikeSurname"><![CDATA[from Person person where person.surname like :surname ]]></query>
<query name="findByLikeSurname2"><![CDATA[from Person person where person.surname like 'bl%' ]]></query>
<query name="findByRetired"><![CDATA[from Person person where dateOfBirth > :todaysDate-65]]></query>
<query name="findByName"><![CDATA[from Person person where person.firstName = :firstName and person.surname = :surname]]></query>-->
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlT
oken [from com.everware.component.unittest.person.Person person]
at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:31)
at antlr.CharScanner.<init>(CharScanner.java:51)
at antlr.CharScanner.<init>(CharScanner.java:60)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:56)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:53)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:50)
at org.hibernate.hql.ast.HqlLexer.<init>(HqlLexer.java:26)
at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:44)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.j
ava:232)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorIm
pl.java:155)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl
.java:105)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCa
che.java:71)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactor
yImpl.java:363)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1164)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
org.hibernate.HibernateException: Errors in named queries: findAllPersons
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1164)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.BaseRootDao.initialize(Unknown
Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)




Name and version of the database you are using: Oracle 9.0.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:DEBUG


18:36:20,552 DEBUG SessionFactoryImpl:292 - instantiated session factory
18:36:20,552 INFO SessionFactoryImpl:353 - Checking 1 named HQL queries
18:36:20,552 DEBUG SessionFactoryImpl:361 - Checking named query: findAllPersons

18:36:20,582 INFO SessionFactoryImpl:373 - Checking 0 named SQL queries
18:36:20,582 ERROR SessionFactoryImpl:336 - Error in named query: findAllPersons



Top
  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 11:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
there are additional issues trying to use the antlr-based parser on weblogic servers because weblogic bundles an older version of antlr itself; and even worse it does not do classpath isolation on the version it uses. the only way around this was to place the newer antlr jar on the weblogic startup classpath *berfore* weblogic.jar (which is where I believe the bundle it).

See http://hibernate.org/250.html#A25. I'd also suggest making sure you use the newest antlr dist (2.7.6rc1) which no longer use Class.forName()


Top
 Profile  
 
 Post subject: Thanks that was it
PostPosted: Wed Jan 25, 2006 12:56 pm 
Thanks


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