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>