No mapping found for dependency

错误信息:java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException,

No mapping found for dependency [type=com.opensymphony.xwork2.conversion.ConversionFileProcessor, name='default'] in public void com.opensymphony.xwork2.conversion.impl.XWorkConverter.setConversionFileProcessor(com.opensymphony.xwork2.conversion.ConversionFileProcessor).



其中struts.xml就放在src目录下



web.xml里的内容如下

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>test</display-name>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    <init-param>
          <param-name>config</param-name>
          <param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value>
      </init-param>

  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring.xml</param-value>
  </context-param>
</web-app>



其中<init-param></init-param>标签及里面的内容去掉也是报同样的错误。




慕粉3613271
浏览 2427回答 1
1回答

大咪

你struts.xml里配置少default这个节点,加上这个试试<include file="struts-default.xml"/>然后web.xml里不用改动
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java