日期:2014-05-18  浏览次数:20701 次

请各位高手帮忙看一下Spring+struts问题
页面错误信息如下:
********************************************************************************************
javax.servlet.ServletException: org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
tsrj.hxjk.pub.filter.SetCharterFilter.doFilter(SetCharterFilter.java:20)


root cause 

org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
tsrj.hxjk.pub.filter.SetCharterFilter.doFilter(SetCharterFilter.java:20)

******************************************************************************


------解决方案--------------------
你的问题有俩个方面发生
1:你的jdk你的编译时和web工程的的java_home是一样的吗
2,你的action的包结构是否写对了 (struct-config。xml)
------解决方案--------------------
你配置错了当然抱找不到action了 因为你的spring配置文件根本就没成功初始化
你可以写个单独的类用Spring ApplicationContext对象把你的Spring配置文件读一下至少也有个准确的错误
告诉你
------解决方案--------------------
Resource resource=new ClassPathResource("applicationContext.xml");
BeanFactory factory=new XmlBeanFactory(resource);
Service service = (Service)factory .getBean("Service");
applicationContext.xml这个放在src下