在Struts2中Struts.xml中的action指定class时找不到怎么办?之前还好用的,求大神指点
报的错误:Unabletoloadconfiguration.-action-file:/D:/Tomcat/webapps/project/WEB-INF/classe...
报的错误:
Unable to load configuration. - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
Caused by: Unable to load configuration. - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
Caused by: Action class [org.struts2.action.search.SearchKindAction] not found - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 21 more 展开
Unable to load configuration. - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
Caused by: Unable to load configuration. - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
Caused by: Action class [org.struts2.action.search.SearchKindAction] not found - action - file:/D:/Tomcat/webapps/project/WEB-INF/classes/struts.xml:10:81
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 21 more 展开
1个回答
展开全部
一般来说,只要web.xml中配置正确的映射路径,struts.xml能够实例化action就不会出现404错误,可能是web.xml中的filter-mapping出现问题
<filter>
<filter-name>action</filter-name>
<filter- class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>action</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
你把<url-pattern>/*</url-pattern>的内容改动后调试看看,good luck!
----------------------------
Struts2的路径和struts1的一致,/ 表示web应用更目录(就是GraPro目录),在struts2中FilterDispatcher就是根据你在web.xml filter-mapping中配置的路径去映射你的请求路径(/news.action),
如果匹配,就加载struts.xml中定义的actionMapping,然后转交action处理请求
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询