weblogic加载hibernate3时,ClassNotFoundException的解决方法

阅读更多

 最近在项目中用weblogic跑Spring+hibernate的运用(在websphere中正常运行)

抛出如下的异常

org.springframework.orm.hibernate3.HibernateQueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]; nested exception is org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]
        at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
        at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
        at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:31)

使用Spring+hibernate如下xml 代码
  1. <property name="hibernateProperties">  
  2.       <props>  
  3.         <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialectprop>  
  4.         <prop key="hibernate.show_sql">falseprop>  
  5.         <prop key="hibernate.cglib.use_reflection_optimizer">trueprop>            
  6.       props>  
  7.     property>  

在配置中加以下属性就可以解决
org.hibernate.hql.ast.ASTQueryTranslatorFactory

 

新增后的xml 代码
  1. <property name="hibernateProperties">  
  2.       <props>  
  3.         <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialectprop>  
  4.         <prop key="hibernate.show_sql">falseprop>  
  5.         <prop key="hibernate.cglib.use_reflection_optimizer">trueprop>  
  6.         <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactoryprop>  
  7.       props>  
  8.     property>  

你可能感兴趣的:(Weblogic,Hibernate,Spring,SQL,Websphere)