GlassFish 3.1.2给出404没有任何部署错误

时间:2012-12-14 02:59:19

标签: deployment glassfish http-status-code-404 war

我尝试将一个非常简单的helloworld.war部署到ubuntu 10.04上的glassfish 3.1.2服务器上。在我的电脑上它工作正常但在我的服务器上我总是得到404页。 我的服务器上没有错误。有人有想法吗?

我注意到另一种奇怪的行为。重启我的服务器后,我无法登录管理控制台。我总是认证失败重新输入您的用户名和密码。当我重新启动glassfish时,它再次起作用。

这听起来很熟悉,但我不知道他的解决方案如何帮助我。 glassfish autodeploy gives 404 with simple app

[#|2012-12-14T02:53:30.368+0100|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=71;_ThreadName=Thread-2;|uploadFileName=HelloWorld-1.0-SNAPSHOT.war|#]

[#|2012-12-14T02:53:30.605+0100|INFO|glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=135;_ThreadName=Thread-2;|Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/HelloWorld-1.0-SNAPSHOT' wird initialisiert.|#]

[#|2012-12-14T02:53:30.729+0100|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=135;_ThreadName=Thread-2;|WEB0671: Loading application [HelloWorld-1.0-SNAPSHOT] at [/HelloWorld-1.0-SNAPSHOT]|#]

[#|2012-12-14T02:53:30.883+0100|INFO|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=135;_ThreadName=Thread-2;|HelloWorld-1.0-SNAPSHOT was successfully deployed in 482 milliseconds.|#]

的index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets
    </h:body>
</html>

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</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>
</web-app>

1 个答案:

答案 0 :(得分:0)

我猜你在一个名为faces的目录中没有index.xhtml ...试试这个:

<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>