【问题标题】:Application Deployed Successful on GlassFish 4.1 but browsing error 404应用程序在 GlassFish 4.1 上成功部署,但浏览错误 404
【发布时间】:2015-01-07 13:55:41
【问题描述】:

我是 java spring 和 glassfish 4.1 的新手 .. 我的应用程序在 glassfish 中部署成功,但浏览错误 404 ..

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">


    <servlet>

    <servlet-name>springapp</servlet-name>

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

  </servlet> 
  <servlet-mapping>
    <servlet-name>springapp</servlet-name>
    <url-pattern>*.htm</url-pattern>
  </servlet-mapping> 
    <welcome-file-list>
    <welcome-file>
      index.jsp
    </welcome-file>
  </welcome-file-list> 
</web-app>

【问题讨论】:

  • 尝试使用管理控制台,然后是 Applications -> 你的应用程序并检查它部署在什么上下文中。
  • 我尝试了管理控制台,也从那里启动,但同样的错误
  • 您使用的确切网址是什么?
  • 那么我敢打赌你的 url-pattern 与那个 URL 不匹配

标签: java spring-mvc glassfish netbeans-8


【解决方案1】:

改变

<url-pattern>*.htm</url-pattern>

<url-pattern>/*</url-pattern>

或使用特定 html 文件的 URL。

【讨论】:

    【解决方案2】:

    尝试添加 url-pattern “.xhtm” 如果您使用 xhtml 文件或 ".jsf" 在 jsf 的情况下。

    【讨论】:

      猜你喜欢
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-22
      • 1970-01-01
      • 2021-08-23
      相关资源
      最近更新 更多