glassfish autodeploy为404提供简单的应用程序

时间:2010-10-11 18:04:26

标签: java jsf glassfish

我安装了vanilla glassfish v3,并将我的.war放在我的Windows PC的C:\glassfishv3\glassfish\domains\domain1\autodeploy文件夹中。战争包含一个用java,JSF,richfaces构建的小型Web应用程序。

glassfish服务器已经启动。

浏览器返回:

The requested resource () is not available.

有点烦人,因为当我使用ant部署到tomcat 6时,这工作正常。我不知道从哪里开始。有什么想法吗?

我的web.xml

<?xml version="1.0"?>
<web-app version="2.5" 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_2_5.xsd">

    <display-name>Client</display-name>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>glassX</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
        <param-value>enable</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.LoadStyleStrategy</param-name>
        <param-value>ALL</param-value>
    </context-param>

    <!-- Added after/for facelets -->
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <!-- To prevent the error below -->
    <!--
        WARNING: facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE is
        set to 'true' \
    -->
    <!-- but facelets.BUILD_BEFORE_RESTORE is set to 'false' or unset. \ -->
    <!--
        To use facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE you
        must also \
    -->
    <!-- set facelets.BUILD_BEFORE_RESTORE to 'true'! -->
    <context-param>
        <param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
        <param-value>false</param-value>
    </context-param>

    <!-- must be the first filter in this file! -->
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <!-- Optional JSF-RI Parameters to Help Debug -->
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/error.jsf</location>
    </error-page>

    <login-config>
        <auth-method>BASIC</auth-method>
    </login-config>

    <!-- For saving configs to disk/loading them from -->
    <servlet>
        <servlet-name>File Servlet</servlet-name>
        <servlet-class>Client.FileServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>File Servlet</servlet-name>
        <url-pattern>/client/temp/*</url-pattern>
    </servlet-mapping>

    <!-- tomcat 6 oracle connection -->
    <resource-ref>
        <description>Oracle Datasource</description>
        <res-ref-name>jdbc/myoracle</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
</web-app>

我不希望这最后一个会导致问题 - 但我不知道在哪里寻找链接glassfish。我是否需要像在企业application.xml中那样显式地声明上下文根?

修改的 在回复回复时,这是在服务器启动之后写入日志目录中server.log的唯一内容,它只列出了INFO行 - 没有警告或SEVERES。注意我还有404:

[#|2010-10-12T10:46:20.193+0100|WARNING|glassfish3.0.1|null|_ThreadID=24;_ThreadName=Thread-1;|Resource not found: com/sun/enterprise/v3/admin/adapter/theme/com/sun/webui/jsf/suntheme/images/masthead/masthead_button_over.gif|#]

我认为这只是服务器中某些不在预期位置而与我的问题无关的内容。

我放了一个sun-web.xml文件,其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD 
Application Server 9.0 Servlet 2.5//EN' 
'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'>
<sun-web-app>
<context-root>/Client</context-root>
</sun-web-app>

它仍然不起作用。因为404建议资源()我怀疑它还有一些东西会再次出现 一个地方,并已部署到另一个地方。

修改

我发现,在部署到另一台机器(不同平台,同样的玻璃鱼版本)时,战争再次部署得很好,但jvm.log barfs这个:

<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy isDisabled (I)Z' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.656'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy isDisabled (I)Z' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='unique_concrete_method' ctxk='org/apache/log4j/spi/LoggerRepository' x='org/apache/log4j/Hierarchy getLogger (Ljava/lang/String;)Lorg/apache/log4j/Logger;' witness='org/apache/log4j/spi/LoggerRepository' stamp='1717891.657'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.374'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.375'/>
<dependency_failed type='leaf_type' ctxk='java/io/File' witness='org/glassfish/deployment/autodeploy/AutoDeployedFilesManager$UndeployRequestedFile' stamp='1717892.375'/>

这有助于解释可能出现的问题吗?

3 个答案:

答案 0 :(得分:0)

你可以反复核对的几件事。

  1. 首先检查是否存在任何部署错误。检查日志。日志将位于SERVER_HOME / domains / domain1 / logs
  2. 您可能必须在sun-web.xml
  3. 中指定应用程序的上下文根
  4. 最好转到SERVER_HOME / domains / domain / applications / j2ee-apps /,并检查您的war文件是否已在此处展开​​。如果部署成功,那么这就是战争爆炸的地方。

答案 1 :(得分:0)

我一直在指定一个省略欢迎文件名的URL,该文件名与默认列表中的any不同。

实质上,我没有要求找到我正在寻找的文件。

答案 2 :(得分:0)

我也遇到了同样的错误。并且,最后观察到localhost:8080端口已经与tomcat和glassfish共享。修复端口冲突后,应用程序就像魅力一样。