日期:2014-05-19  浏览次数:20754 次

我在SSH2配置了两个applicationContext.xml连接两个数据库
我配置了两个applicationContext.xml(applicationContext_Elec.xml和applicationContext_OA.xml)连接两个数据库,我在web.xml里这么配置
<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:applicationContext_*.xml</param-value>
 </context-param>

这以我可以确定单独运行哪一个.xml文件都是可以访问数据库的,但是,就是两个放在一起,启动tomcat不会报错。进行action操作的时候报下面的错
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.a30elec.entity.Task; nested exception is org.hibernate.MappingException: Unknown entity: com.a30elec.entity.Task
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
at com.a30elec.daoimpl.TaskDaoImpl.findAgoTaskNo(TaskDaoImpl.java:195)
at com.a30elec.serviceimpl.TaskServiceImpl.findAgoTaskNo(TaskServiceImpl.java:61)

求大神指教
ssh 数据库 nested

------解决方案--------------------
classpath:applicationContext_*.xml
这样写两个文件都会读的吧
------解决方案--------------------
和web.xml配置无关,web.xml配置是对的
------解决方案--------------------
引用:
引用:引用:
引用:classpath:applicationContext_*.xml
这样写两个文件都会读的吧
应该两个文件都读了,我把其中一个文件改成错的。tomcat启动就会报错,说明这两个文件都读到了,可是为什么不能执行操作sql的方法呢,一执……


我们公司不能上q 。 邮箱吧  is_zhoufeng@163.com