SSH整合出现的错误

来源:互联网 发布:linux清除某个命令 编辑:程序博客网 时间:2024/04/29 03:33

做了一个SSH整合的小程序,出现了如下错误:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'mapService' is defined

因为applicationContext.xml里引用到了ssh.xml,ssh.xml里面的确定义了bean:mapService

<bean id="mapService" class="yao.service.MapService">
      <constructor-arg>
      <!-- 通过构造方法的参数将MapDAO对象传入业务逻辑层组件 -->
      <ref bean="mapDAO" />
      </constructor-arg>
  </bean>
错误出在配置文件上,挨个找applicationContext.xml、Struts-config.xml和web.xml最后发现web.xml里面没有定义ssh.xml的路径。在web.xml加上如下内容:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/ssh.xml,/WEB-INF/applicationContext-*.xml</param-value>
 </context-param>

就没有错误了。