<!------------struts2 there is no action mapped for namespac------------------->

tyhdxhl 2015-09-22 11:40:48
登录成功后点击分类列表
2015-09-22 11:05:50,632There is no Action mapped for namespace /admin and action name showCategory. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.components.ActionComponent.executeAction(ActionComponent.java:287)
at org.apache.struts2.components.ActionComponent.end(ActionComponent.java:173)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
at org.apache.jsp.admin.allCategory_jsp._jspx_meth_s_005faction_005f0(allCategory_jsp.java:291)
at org.apache.jsp.admin.allCategory_jsp._jspService(allCategory_jsp.java:133)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:619)

struts.xml 配置如下

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.objectFactory" value="spring"/>
<constant name="struts.configuration.xml.reload" value="true" />
<constant name="struts.multipart.maxSize" value="5242880"/>
<package name="struts2" extends="struts-default" namespace="/">
<action name="loginAction" class="loginAction">
<result name="success">admin/index.jsp</result>
<result name="error">Login.jsp</result>
</action>

<action name="addArticle" class="addArticle">
<result name="success">admin/addArticle.jsp</result>
</action>

<action name="deleteArticle" class="deleteArticle">
<result name="success">admin/allArticle.jsp</result>
</action>

<action name="showAllArticle" class="showAllArticle">
<result name="success">admin/allArticle.jsp</result>
</action>

<action name="showArticle" class="showArticle">
<result name="success">article.jsp</result>
</action>

<action name="showArticleByCat" class="showArticleByCat">
<result name="success">category.jsp</result>
</action>

<action name="showTopTenArticle" class="showTopTenArticle">
</action>

<action name="addComment" class="addComment">
<result name="success">article.jsp</result>
</action>

<action name="deleteComment" class="deleteComment">
<result name="success">admin/allComment.jsp</result>
</action>

<action name="showComment" class="showComment">
<result name="success">article.jsp</result>
</action>

<action name="getAllComment" class="getAllComment">
<result name="success">admin/allComment.jsp</result>
</action>

<action name="addAlbum" class="com.blog.action.AddAlbum">
<result name="success">admin/allAlbum.jsp</result>
<result name="error">admin/allAlbum.jsp</result>
</action>

<action name="deleteAlbum" class="com.blog.action.DeleteAlbum">
<result name="success">admin/allAlbum.jsp</result>
</action>

<action name="showAlbum" class="com.blog.action.ShowAlbum">
</action>

<action name="photoUpload" class="com.blog.action.PhotoUpload">
<result name="success">admin/allAlbum.jsp</result>
</action>

<action name="addCategory" class="addCategory">
<result name="success">admin/allCategory.jsp</result>
</action>

<action name="showCategory" class="showCategory">
</action>

<action name="deleteCategory" class="deleteCategory">
<result name="success">admin/allCategory.jsp</result>
</action>

<action name="showPhoto" class="com.blog.action.ShowPhoto">
<result name="success">photo.jsp</result>
</action>

<action name="showRss" class="showRss">
<result name="success">rss.xml</result>
</action>
</package>
</struts>


web.xml 配置如下

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>

<error-page>
<error-code>500</error-code>
<location>/404.jsp</location>
</error-page>
</web-app>



我很纳闷,然后到百度上搜了一下,发现铺天盖地的都是这个异常,长达14页多
根据网友回答反复尝试确认折腾一早上之后,还是没找到错误
我的struts.xml是在src目录下的 希望高手来帮忙一下。
...全文
52 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
tyhdxhl 2015-09-22
这是项目目录


回复
tyhdxhl 2015-09-22
在线等 求大神指点
回复
tyhdxhl 2015-09-22
求大神指点 在线等
回复
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-09-22 11:40
社区公告
暂无公告