为什么每次我重新启动Glassfish时都必须重新部署应用程序?

时间:2019-03-27 05:44:16

标签: netbeans glassfish

我是堆栈溢出的第一次用户,是Glassfish的新手。

我正在使用NetBeans 8.2和Glassfish 5.0,我的应用程序正在使用Primefaces和JSF。

我可以使用NetBeans或通过.war文件将应用程序成功部署到Glassfish,但是每次重新启动Glassfish时,当我尝试访问Web应用程序时都会收到404错误。然后,我需要重新部署我的应用程序才能使其再次运行。我能够通过NetBeans进行重新部署而不会出现问题,但是如果使用.war文件,则需要先进行重新部署。

我在不受重启影响的同一服务器上运行了一个测试应用程序。

我已经研究了堆栈溢出时的类似问题,并尝试修改web.xml,但这似乎无济于事。我怀疑这是我的配置错误,这是我的web.xml。

<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">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE Production</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
    <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
    <param-value>true</param-value>
</context-param>
</web-app>

我期望Web应用程序不受Glassfish服务器重启的影响,但是需要重新部署才能重新启动后才能成功运行。

任何建议,我们将不胜感激。 :)

0 个答案:

没有答案