【问题标题】:The requested resource (/StrutsHelloWorld/) is not available. Jboss AS7 Server请求的资源 (/StrutsHelloWorld/) 不可用。 Jboss AS7 服务器
【发布时间】:2013-09-04 17:30:38
【问题描述】:

我正在尝试使用 Jboss AS 7 Server 构建我的第一个 struts 应用程序。

部署后出现以下错误:

HTTP Status 404 - /StrutsHelloWorld/

type Status report

message /StrutsHelloWorld/

description The requested resource (/StrutsHelloWorld/) is not available.
JBoss Web/7.0.13.Final

我按照http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/ 的指南更改了我的web.xml 文件

<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

我没有部署错误。

以下是我的文件:

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" 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>Struts2 Application</display-name>
    <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>
    <welcome-file-list>
        <welcome-file>Login.jsp</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>
    <constant name="struts.enable.DynamicMethodInvocation"
        value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources"
        value="ApplicationResources" />

    <package name="default" extends="struts-default" namespace="/">
        <action name="login" 
            class="net.viralpatel.struts2.LoginAction">
            <result name="success">Welcome.jsp</result>
            <result name="error">Login.jsp</result>
        </action>
    </package>
</struts>

Jar 文件:

commons-fileupload-1.3.jar、commons-io-2.0.1.jar、 commons-logging-1.1.3.jar,commons-logging-api-1.1.jar, freemarker-2.3.19.jar、ognl-3.0.6.jar、struts-core-2.3.15.1.jar、 xwork-core-2.3.15.1.jar

【问题讨论】:

    标签: java struts2 jboss http-status-code-404 xml-configuration


    【解决方案1】:

    将以下配置添加到您的 "/" 包中

    <action name="">
      <result>/Login.jsp</result>
    </action>
    

    并删除

    <welcome-file-list>
        <welcome-file>Login.jsp</welcome-file>
    </welcome-file-list>  
    

    【讨论】:

    • 我关注了但仍然无法正常工作.. HTTP 状态 404 - /StrutsHelloWorld/ 类型状态报告消息 /StrutsHelloWorld/ 描述 请求的资源 (/StrutsHelloWorld/) 不可用。 JBoss Web/7.0.13.Final 我从 web.xml 中删除了 并将 添加到 struts.xml
    • 什么不起作用?由于添加默认操作和删除欢迎文件,404 已解决,您在 Web 内容根文件夹中没有 Login.jsp 吗?它对我很好。你确定你在 url 中有正确的上下文路径吗?
    • 或者你错误地部署了你的webapp,你正在运行哪个服务器实例,将.war文件部署到部署位置。在使用 JBoss 之前,您是否尝试将其部署到 Tomcat?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-10
    • 2017-06-23
    • 2019-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多