9 Ocak 2012 Pazartesi

Weblogic 10.3.2 and Hibernate Named Query Problem

If you use Hibernate 3.3.X, 3.4.X with Weblogic 10.3.X , and choose to use named queries , most probably you gonna get below exception ;

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

The problem the versions of antlr.jar , weblogic and hibernate are not compatible. You should put antlr.jar 1.4.X as a first item in weblogic server classpath. You can change startWebLogic.cmd for Windows , startWebLogic.sh for linux file at directory %WEBLOGIC_HOME%/user_projects/domains/%YOUR_DOMAIN%/bin/.

set SAVE_CLASSPATH=%CLASSPATH%

You should change upper line such as for windows environment;

set SAVE_CLASSPATH=%CLASSPATH%
set CLASSPATH=%antlr_path%\antlr.jar;%SAVE_CLASSPATH%