Friday, March 30, 2007

OC4J+JPA+Hibernate3+spring antlr problem

Setup:
OC4J 10.1.3.2
Spring 2.0.3
Hibernate 3.2.2 as JPA persistence provider.

Problem:
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken


Analysis:
There's an old antlr.jar in the toplink-lib that comes with OC4J. You have to use the one that comes with
Hibernate.

Solution:
Avoid oracle's toplink stuff to be loaded.
in orion-application.xml, enter:

<orion-application>
<imported-shared-libraries>
<remove-inherited name="oracle.toplink">
</remove-inherited>
</imported-shared-libraries>

See
Oracle® Containers for J2EE Developer's Guide chapter 3.

IIRC there's even a property in the EM that you can set to do this while deploying.


2 comments:

Elvis from hell said...

An alternative would be to use an own imported library, as Debu Panda does here

xilu said...

Thanks a lot, it helped.