我比着例子做的,却无法执行,报Error 404--Not Found错误,
Action:
package com.test.action;import com.opensymphony.xwork2.ActionSupport;public class LoginAction extends ActionSupport {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}

public String execute() throws Exception{
return SUCCESS;
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  
  <display-name>Struts Blank</display-name>    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list></web-app>
struts.xml
<!DOCTYPE struts PUBLIC        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"        "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
<package name="abc" namespace="/abc" extends="struts-default">
<action name="LoginAction" class="com.text.action.LoginAction">
<result>/success.jsp</result>
</action>
</package></struts>
用的MyEclipse6.0+Weblogic9+JDK5.0
struts.xml文件放在WebRoot\WEB-INF\classes\下
麻烦请指教!!!

解决方案 »

  1.   

    这个错误好像是启动不起来。不是你页面找不到的原因,应该是filter加载出现了问题,在启动服务器的时候应该会报一个错误的。
      

  2.   

    对对,在我Weblogic9的时候就出现一个这样的异常,但是Weblogic9还是能启动,我感觉也是那里出了问题,包也加对了,就是不知道为什么,果然遇到高手了
      

  3.   

    这种问题,最简单就是你的uri写错了,注意在你的JSP页面的form里的ACTION有没有写对,struts.xml里的action里有没有写对。
      

  4.   

    这是Weblogic9启动的时候遇到的问题,希望高手来帮忙
    2008-1-11 8:17:47 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
    信息: Parsing configuration file [struts-default.xml]
    <2008-1-11 上午08时17分47秒 CST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
    Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:D:/bea/user_projects/domains/base_domain/./servers/AdminServer/tmp/_WL_user/_appsdir_TestStruts2_dir/cimmer/war/WEB-INF/lib/struts2-core-2.0.9.jar!/struts-default.xml:8:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
    Truncated. see log file for complete stacktrace
    Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:D:/bea/user_projects/domains/base_domain/./servers/AdminServer/tmp/_WL_user/_appsdir_TestStruts2_dir/cimmer/war/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:30:72 - bean - zip:D:/bea/user_projects/domains/base_domain/./servers/AdminServer/tmp/_WL_user/_appsdir_TestStruts2_dir/cimmer/war/WEB-INF/lib/struts2-core-2.0.9.jar!/struts-default.xml:8:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
    Truncated. see log file for complete stacktrace
      

  5.   

    你的PACKAGE从程序上看是com.test.action,而你的配置文件里却是abc,还有你的namespace不要用,应为你的程序并不是很复杂<!DOCTYPE   struts   PUBLIC                 "-//Apache   Software   Foundation//DTD   Struts   Configuration   2.0//EN"                 "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> 
    <package   name="com.test.action"  extends="struts-default"> 
    <action   name="LoginAction"   class="com.test.action.LoginAction"> 
    <result> /success.jsp </result> 
    </action> 
    </package> </struts> 
      

  6.   

    有可能是版本的原因,把那个包删了重新导入下试试,应该是web.xml里的问题,如果这里没问题就是包 物理损坏了。。你这个启动不起来应该不是struts.xml的问题。。再仔细查查吧,具体问题还得具体分析,具体解释,只靠说管不了多大用。
      

  7.   

    http://blog.csdn.net/laiahu/archive/2007/10/30/1855998.aspx