Java Struts 2应用程序引发404异常

Java Struts 2应用程序引发404异常,java,jsp,struts2,Java,Jsp,Struts2,在我的struts 2.3.16.1应用程序中,web.xml资源中的过滤器映射后,未发现异常发生。甚至web目录中的jsp页面也显示相同的异常。 提前谢谢你的帮助 <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.

在我的struts 2.3.16.1应用程序中,web.xml资源中的过滤器映射后,未发现异常发生。甚至web目录中的jsp页面也显示相同的异常。 提前谢谢你的帮助

       <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>
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>
    <package name="default" extends="struts-default">
    <action name="getTutorial" class="org.kishore.struts2.TutorialAction">
    <result>/success.jsp</result>
    </action>

    </package>

    </struts>
如果你的错误是

类型状态报告

message/YourProjectName/success.jsp

说明请求的资源不可用

那就意味着你的success.jsp页面丢失了

若消息为空且控制台中的错误为

无法加载配置。-操作-文件:/C:/Users/Parth/workspace1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/serializ/WEB-INF/classes/struts.xml:7:75

那么您的类org.kishore.struts2.TutorialAction.java将丢失

如果您遇到以下错误

严重:调度程序初始化失败,无法加载配置。-bean-jar:file:/F:/apache-tomcat-6.0.39/wtpwebapps/struts2启动程序/WEB-INF/lib/struts2-‌​portlet-plugin-2.3.16.1.jar/struts plugin.xml:31:133位于com.opensymphony.xwork2.config.ConfigurationManager.getConfigurationConfigurati‌​java:70

原因:java.lang.ClassNotFoundException:javax.portlet.PortletMode

这意味着下载,因为没有它,您将无法使用struts2-‌​portlet-plugin-2.3.16.1.jar。如果不添加Portlet Api 2.0.jar,您将继续得到错误java.lang.ClassNotFoundException:javax.Portlet.PortletMode

注意:还要确保您使用的jar的兼容版本与struts-core-2.x.x.jar的版本相同


例如,如果您使用的是struts2-core-2.2.3.jar,那么必须使用struts2-‌​portlet-plugin-2.2,3.jar。

当我尝试访问getTutorial.action时,资源/页面返回404?的请求。我认为它正在为提供jsp页面路径而运行,我在控制台中遇到以下严重错误:调度程序初始化失败无法加载配置。-bean-jar:file:/F:/apache-tomcat-6.0.39/wtpwebapps/struts2starter/WEB-INF/lib/struts2-portlet-plugin-2.3.16.1.jar/struts plugin.xml:31:133位于com.opensymphony.xwork2.config.ConfigurationManager.getConfigurationConfigurationManager.java:70I更新的答案。请看。如果还有错误,请告诉我。如果您是stackoverflow新手,请查看我使用的是struts2-‌​portlet-plugin-2.3.16.1.jar和struts-core-2.3.16.1.jar都是同一个版本。不过我还是收到了我在回答中添加的错误。请注意:也下载portlet Api 2.0.jar,因为没有它,您将无法使用struts2-‌​portlet-plugin-2.3.16.1.jar。