我用的是weblogic9.2
有两个项目,用相同的ssh架构,单独放在weblogic下面启动没有问题,但同时将两个项目部署时,weblogic就会抛异常。
两个项目中有相同的hbm.xml文件,名称及映射都相同。我不明白的是为什么weblogic启动时,两个项目会互相检查各自的hbm.xml文件,而引起重复引用mapping的错误?
下面是后台打出的异常
####<2009-3-12 下午04时38分50秒 CST> <Info> <ServletContext-/ckba> <zlt-hjy> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236847130937> <000000> <Set web app root system property: 'ckba.root' = [C:\bea\user_projects\domains\base_domain\autodeploy\ckba\]> 
####<2009-3-12 下午04时38分51秒 CST> <Info> <ServletContext-/ckba> <zlt-hjy> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236847131187> <000000> <Initializing Log4J from [C:\bea\user_projects\domains\base_domain\autodeploy\ckba\WEB-INF\classes\Log4j.properties]> 
####<2009-3-12 下午04时38分51秒 CST> <Info> <ServletContext-/ckba> <zlt-hjy> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236847131218> <000000> <Loading Spring root WebApplicationContext> 
####<2009-3-12 下午04时38分54秒 CST> <Warning> <HTTP> <zlt-hjy> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236847134750> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.business.baoan.service.IBaoanService' defined in ServletContext resource [/WEB-INF/classes/applicationContext-baoan.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\bea\user_projects\domains\base_domain\autodeploy\yccd\WEB-INF\classes\com\business\admin\domain\query\adminSqlQuery.hbm.xml.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.business.baoan.service.IBaoanService' defined in ServletContext resource [/WEB-INF/classes/applicationContext-baoan.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\bea\user_projects\domains\base_domain\autodeploy\yccd\WEB-INF\classes\com\business\admin\domain\query\adminSqlQuery.hbm.xml

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\bea\user_projects\domains\base_domain\autodeploy\yccd\WEB-INF\classes\com\business\admin\domain\query\adminSqlQuery.hbm.xml

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\bea\user_projects\domains\base_domain\autodeploy\yccd\WEB-INF\classes\com\business\admin\domain\query\adminSqlQuery.hbm.xml

org.hibernate.InvalidMappingException: Could not parse mapping document from file C:\bea\user_projects\domains\base_domain\autodeploy\yccd\WEB-INF\classes\com\business\admin\domain\query\adminSqlQuery.hbm.xml

org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.business.admin.domain.view.LimitsView

解决方案 »

  1.   

    不会是在同一个domain下吧!
    spring 那个xml在domain下是全局的!
      

  2.   

    恩,就是在同一个domain下面,如何解决呢?建立多个domain,然后把项目放在各自的domain下吗?那端口问题怎么解决?
      

  3.   

    多个domain,不同的项目放到不同的domain下嘛!
    weblogic9.2修改端口号。
    \bea9\user_projects\domains\base_domain\config\config.xml
    该文件默认端口号7001的情况没有<listen-port>标签。
    如要修改为其他端口号,需要加上类似的<listen-port>7003</listen-port>语句即可。