1.启动weblogic时报错:ClassNotFoundException: org.hibernate.hql.ast.HqlTokenhtml
解决办法:拥有Hibernate3.jar的应用,被部署到weblogic8.1上后,抛出异常 CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken。
解决方法:在hibernate.properties上,或是在spring的conext xml中,加上一个属性hibernate.query.factory_class,值为org.hibernate.hql.classic.ClassicQueryTranslatorFactory。web缘由:从网上获知,weblogic.jar中已经有了一个antlr.jar的版本,致使应用中hibernate3.jar中用到的antlr.jar不能找到,致使异常。spring
如:sql
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql"> true </prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.classic.ClassicQueryTranslatorFactory </prop> <prop key="connection.useUnicode"> true </prop> <prop key="connection.characterEncoding"> utf-8 </prop> </props> </property> <property name="mappingResources"> <list> <value>org/main/manage/entity/TInfo.hbm.xml</value> </list> </property> </bean>