Struts2一直报错,求解....

meic1985 2012-12-24 04:36:01
这两天用ecplise新建一个struts2的项目,但是访问的时候一直报错,
警告: Could not find action or result
There is no Action mapped for namespace [/] and action name [login] associated with context path [/migo]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)


网上查看好多解决方法,但是都没有解决,实在找不出错误的地方,请高人指点。

这个是项目目录


这个是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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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>Migo</display-name>

<filter>
<!-- 配置Struts2核心Filter的名字 -->
<filter-name>struts2</filter-name>
<!-- 配置Struts2核心Filter的实现类 -->
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- 配置Filter拦截的URL -->
<filter-mapping>
<!-- 配置Struts2的核心FilterDispatcher拦截所有用户请求 -->
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

这个是struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- struts2的action必须放在一个指定的包空间下定义 -->
<package name="default" extends="struts-default">
<!-- 定义处理请求URL为login.action的Action -->
<action name="login" class="sdsdmigo.login.action.LoginAction">
<!-- 定义处理结果字符串和资源之间的映射关系 -->
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
</struts>

这个是项目启动信息
2012-12-24 16:21:23 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Program Files\Java\jdk1.6.0_32\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\Program Files\Java\jdk1.6.0_32\jre\bin;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;e:\oracle\product\10.2.0\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\SSH Communications Security\SSH Secure Shell;E:\eclipse;;.
2012-12-24 16:21:24 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-12-24 16:21:24 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 709 ms
2012-12-24 16:21:24 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-12-24 16:21:24 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.35
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts.xml, skipping
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ObjectFactory)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.FileManagerFactory)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.LocaleProvider)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.CollectionConverter)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.ArrayConverter)
2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.DateConverter)
2012-12-24 16:21:25 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.NumberConverter)
2012-12-24 16:21:25 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.StringConverter)
2012-12-24 16:21:25 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2012-12-24 16:21:25 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2012-12-24 16:21:25 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2012-12-24 16:21:25 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2012-12-24 16:21:25 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2012-12-24 16:21:25 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2012-12-24 16:21:25 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2012-12-24 16:21:25 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-12-24 16:21:25 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-12-24 16:21:25 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/23 config=null
2012-12-24 16:21:25 org.apache.catalina.startup.Catalina start
信息: Server startup in 1833 ms
...全文
337 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
dracularking 2012-12-26
  • 打赏
  • 举报
回复
引用 17 楼 meic1985 的回复:
引用 15 楼 dracularking 的回复: 引用 9 楼 meic1985 的回复:引用 7 楼 txwoaify0506 的回复:很明显的错误:There is no Action mapped for namespace [/] and action name [login] <action name="login" class="sdsdmigo.login.action……
如果他报错可以更细化一点就好了 no action found in WebContent/WEB-INF/classess for namespace [/] and action name [login] associated with context path [/migo].
meic1985 2012-12-26
  • 打赏
  • 举报
回复
引用 15 楼 dracularking 的回复:
引用 9 楼 meic1985 的回复:引用 7 楼 txwoaify0506 的回复:很明显的错误:There is no Action mapped for namespace [/] and action name [login] <action name="login" class="sdsdmigo.login.action.LoginAction">……
原来是发布的路径不对,默认的output路径是eclipse设置的built/classess,改成项目的WebContent/WEB-INF/classess就可以了。
meic1985 2012-12-26
  • 打赏
  • 举报
回复
引用 14 楼 showboat1988 的回复:
引用 10 楼 meic1985 的回复:引用 6 楼 showboat1988 的回复:namespace 命名空间问题 什么问题? 你这说了等于没说... 在jsp的action中的请求上写个name属性,可以从网上看看相关的代码分析
只是访问一个url报错,又不是jsp提交过去的,所以跟jsp没有关系。
兔子侠客 2012-12-25
  • 打赏
  • 举报
回复
index.html ______________-index.jsp
dracularking 2012-12-25
  • 打赏
  • 举报
回复
引用 9 楼 meic1985 的回复:
引用 7 楼 txwoaify0506 的回复:很明显的错误:There is no Action mapped for namespace [/] and action name [login] <action name="login" class="sdsdmigo.login.action.LoginAction"> 这里错了,都没看见你有sdsdmi……
看这里貌似是加载了struts.xml了 2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Unable to locate configuration files of the name struts.xml, skipping 2012-12-24 16:21:24 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts.xml] 为了确认,可以试着其它改法,比如将struts.xml中根节点改名
meic1985 2012-12-25
  • 打赏
  • 举报
回复
引用 6 楼 showboat1988 的回复:
namespace 命名空间问题
什么问题? 你这说了等于没说...
meic1985 2012-12-25
  • 打赏
  • 举报
回复
引用 7 楼 txwoaify0506 的回复:
很明显的错误:There is no Action mapped for namespace [/] and action name [login] <action name="login" class="sdsdmigo.login.action.LoginAction"> 这里错了,都没看见你有sdsdmigo这个目录,应该是migo
这个是我故意写错的,但是启动的时候竟然没有报错,所以我一直觉得是我的struts.xml文件没有加载成功。
-tomcat- 2012-12-25
  • 打赏
  • 举报
回复
引用 10 楼 meic1985 的回复:
引用 6 楼 showboat1988 的回复:namespace 命名空间问题 什么问题? 你这说了等于没说...
在jsp的action中的请求上写个name属性,可以从网上看看相关的代码分析
meic1985 2012-12-25
  • 打赏
  • 举报
回复
引用 4 楼 net_lover 的回复:
<action name="login" class="sdsdmigo.login.action.LoginAction"> 你这个class写错了吧?多了sdsd?
这个是我故意写错的,但是启动的时候竟然没有报错,所以我一直觉得是我的struts.xml文件没有加载成功。
txwoaify0506 2012-12-25
  • 打赏
  • 举报
回复
很明显的错误:There is no Action mapped for namespace [/] and action name [login] <action name="login" class="sdsdmigo.login.action.LoginAction"> 这里错了,都没看见你有sdsdmigo这个目录,应该是migo
SunshineADCboy 2012-12-25
  • 打赏
  • 举报
回复
还想知道下你页面是怎么调用的,你说你启动没报错是吧。那页面能打开么
meic1985 2012-12-25
  • 打赏
  • 举报
回复
怎么沉了,传说中的高人在哪儿。
-tomcat- 2012-12-24
  • 打赏
  • 举报
回复
namespace 命名空间问题
licip 2012-12-24
  • 打赏
  • 举报
回复
引用 4 楼 net_lover 的回复:
<action name="login" class="sdsdmigo.login.action.LoginAction"> 你这个class写错了吧?多了sdsd?
+1class的包写错了。
孟子E章 2012-12-24
  • 打赏
  • 举报
回复
<action name="login" class="sdsdmigo.login.action.LoginAction"> 你这个class写错了吧?多了sdsd?
笑莫问 2012-12-24
  • 打赏
  • 举报
回复
访问不到你的路径,启动是有没有报错信息。
meic1985 2012-12-24
  • 打赏
  • 举报
回复
引用 1 楼 liu4626846 的回复:
能看看你访问的路径吗?
http://localhost:8080/migo/ http://localhost:8080/migo/login.action 这两个都报错的
liu4626846 2012-12-24
  • 打赏
  • 举报
回复
能看看你访问的路径吗?

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧