cancel
Showing results for 
Search instead for 
Did you mean: 

Hibernate ClassNotFoundException: org.hibernate.hql.ast.HqlToken

steffen_spahr2
Participant
0 Kudos

Hi,

last week I have installed the new preview version of the J2EE 1.4 compatible WAS.

It worked very well but using Hibernate 3.1.3 leads to the following error:

"javax.servlet.ServletException: org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [select tab.persNr from de.braunschweigit.CTG.db.AidNrPersNrTabelle as tab where tab.aidNr = :aidNr]"

In the Internet I found one solution for the problem:

<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory

</property>

Hibernate3 comes with a brand-new, ANTLR-based HQL/SQL query translator. However, the Hibernate 2.1 query parser is still available. The query parser may be selected by setting the Hibernate property hibernate.query.factory_class. The possible values are org.hibernate.hql.ast.ASTQueryTranslatorFactory, for the new query parser, and org.hibernate.hql.classic.ClassicQueryTranslatorFactory, for the old parser. We are working hard to make the new query parser support all queries allowed by Hibernate 2.1. However, we expect that many existing applications will need to use the Hibernate 2.1 parser during the migration phase.

--->

But now I'm looking for a way to use the new query parser of Hibernate!!!

Is anyone there who can help me finding a solution?

I only found an explanation in the Websphere-Forum:

BEA Weblogic issues

Hibernate3 uses ANTLR for the new query parser. Unfortunately BEA Weblogic includes a version of ANTLR in the system classpath which will be loaded before any application libraries and, because Weblogic doesn't seem to support proper class loader isolation, will not see the Hibernate classes in the application's context. BEA seems to solve this issue by prefixing package names, but the distributed ANTLR doesn't have this prefix. Another source for this issue is the usage of Class.forName() in ANTLR itself.

Maybe it's the same reason for the error on the WAS J2EE 1.4 preview version?

Yours sincerly

Steffen Spahr

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi. This happens because SAP Netweaver loads its own ANTLR.jar library before the one shipped with hibernate.

Check this link https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60642a88-95fe-2b10-d387-a245d48f... that explains how to load Hibernate jars before the ones from SAP Netweaver.

Unfortunatelly we still have this problem, but you may get more lucky than us.

If you find a solution for this, please share it.

Thanks.

Former Member
0 Kudos

Did you find a fix to this problem?

Thanks

steffen_spahr2
Participant
0 Kudos

Hi,

no until now I couldn't find a solution, sorry.

Bye

Steffen