真奇怪!Weblogic81下创建Hibernate SessionFactory失败

09-04-11 pengpenglin

如题,本人的本地开发环境为:JDK1.4 + Weblogic8.1 + Spring2.0 + Hibernate3.2

应用部署到本地的Weblogic8.1和Tomcat5.0/5.5都完全正常,但是一部署到公司的Weblogic8.1上就报错,错误提示如下:
weblogic.management.ManagementException: weblogic.management.DeploymentException:
Exception:weblogic.management.ApplicationException: start() failed.
Module: ECoupon Error: weblogic.management.DeploymentException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.setMergeAdjacentText(Z)V - with nested exception:
[java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.setMergeAdjacentText(Z)V]
at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDeployer.java:720)
at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHandler.java:35)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
No Exception Messages

一开始我将Dom4j包替换为1.6.1版本但错误还是依然出现。后来我试着逐步修改spring的applicationContext.xml文件,发现是在访问hbm文件时错误,Spring配置文件如下:

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<ref bean="hibernateProperties" />
</property>
<property name="mappingResources">
<list><value>Merchant.hbm.xml</value></list>
</property>
</bean>

我发现一旦我把<list><value>Merchant.hbm.xml</value></list>去掉,部署就正常,如果加上就会出现以上的错误,但是我的hbm文件看起来没有什么错误啊,本地都可以正常运行:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="com.three.hk.ecoupon.domain.Merchant"
table="MERCHANT">

<id name="id" column="ID">
<generator class="native"/>
</id>
<property name="name" column="NAME" unique="true" not-null="true"/>
</class>

</hibernate-mapping>

实在是百思不得其解?请各位高手指教!!!
[该贴被pengpenglin于2009-04-11 21:16修改过]
[该贴被pengpenglin于2009-04-11 21:17修改过]
[该贴被pengpenglin于2009-04-11 21:18修改过]

banq
2009-04-14 14:59

查询一下Weblogic下配置Hibernate的 一些文章