java - 应用程序部署在 jboss 上,但当我尝试访问时出现 404 错误

标签 java spring maven jboss

所以,我已经在 J​​BOSS(Linux 盒子)上部署了我的应用程序,当我尝试访问 URL 时,它给了我 404 错误。 我已在本地 JBOSS 上部署并测试了相同的应用程序,并且运行完美。 我的 Web.xml 文件:

<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>Server-status Monitoring</display-name>

    <welcome-file-list>
        <welcome-file>WEB-INF\jsp\systemsettings\serverStatus.jsp</welcome-file>
    </welcome-file-list>


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

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:WEB-INF/spring-mvc-servlet.xml</param-value>
    </context-param>

    <servlet>
        <servlet-name>spring-mvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring-mvc</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <jsp-config>

        <taglib>
            <taglib-uri>http://displaytag.sf.net</taglib-uri>
            <taglib-location>/WEB-INF/tlds/displaytag.tld</taglib-location>
        </taglib>

        <taglib>
            <taglib-uri>/gridtags</taglib-uri>
            <taglib-location>/WEB-INF/tlds/grid-converter-changed.tld</taglib-location>
        </taglib>


    </jsp-config>


</web-app>

我的 spring-mvc-servlet.xml 文件:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean name="/*.do" class="com.sterling.ag.controller.ServerStatusController">
        <property name="serverStatusFacade">
            <bean class="com.sterling.ag.facadeImpl.ServerStatusFacadeImpl" />
        </property>
    </bean>

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/jsp/systemsettings/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>


</beans>

最佳答案

正如我们在您的 web.xml 中看到的

您正在使用WEB-INF\jsp\systemsettings\serverStatus.jsp

您应该使用WEB-INF/jsp/systemsettings/serverStatus.jsp

不要使用"\",而是使用"/"

关于java - 应用程序部署在 jboss 上,但当我尝试访问时出现 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13854826/

相关文章:

java - 将 mysql 连接器添加到 eclipse 中的 maven/nexus 构建

java - 在环境变量中添加了JAVA_HOME,但tomcat说看不到它

java - 如何使用数组自动生成 ID?如何为每个 cargo 订单创建 cargo 状态?

java - 安装时自动从 Sourceforge 下载

java - 测试 Spring Boot 命令行应用程序

java - spring rest Controller 中 json 验证中强制属性的注释

android - 警告(junit.framework.TestSuite $1): Exception in constructor when executing Android Test by Maven

java - 如果在第一个作业之后我们在控制台输出中获得了特定值,如何在 Jenkins 中运行第二个作业

spring - WebMvcConfigurerAdapter 不起作用

maven-2 - Maven 依赖版本范围是否应该被视为已弃用?