【问题标题】:Glassfish: Deployment Configuration for this project not foundGlassfish:找不到此项目的部署配置
【发布时间】:2015-02-25 08:16:59
【问题描述】:

我正在尝试修复 glassfish warning: context path differs from bundle,但至少无法通过 IDE 创建 glassfish-web.xml 文件:

找不到此项目的部署配置。部署 描述符版本无法正确设置。

【问题讨论】:

    标签: netbeans deployment configuration glassfish web.xml


    【解决方案1】:

    您不需要 glassfish-web.xml。在您的项目中,您已经有了一个 web.xml,这就是您所需要的。签入该文件以查看您的上下文根目录是否有前导“/”。

    您还可以在 servlet 本身中设置上下文根,因此请检查其中的上下文根。您可能会发现一个有前导斜杠,而另一个没有。

    【讨论】:

    • 我没有在 web.xml (?) 中看到上下文。我用谷歌搜索,看到 Eclipse 用户正在点击项目属性,所以我偶然发现了我作为答案发布的“解决方案”。 Netbeans 有时让我想发誓。感谢您的帮助。 web.xml 中应该有上下文元素吗?
    • 通过 web.xml 设置上下文根是可选的。您可能会发现 Oracle 的官方 Java EE 7 教程很有用:docs.oracle.com/javaee/7/tutorial 右上角有一个可下载的 PDF/epub 等链接,因此您可以搜索 web.xml 之类的内容并查看它的用途。
    【解决方案2】:

    glassfish-web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
    <glassfish-web-app error-url="">
      <context-root>/CRM</context-root>
      <class-loader delegate="true"/>
      <jsp-config>
        <property name="keepgenerated" value="true">
          <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
      </jsp-config>
    </glassfish-web-app>
    

    web.xml:

    <?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">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
         <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</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>*.xhtml</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
        </welcome-file-list>
    </web-app>
    

    注意,所以,有时会发生一些事情。选择Web组件项目,右键,运行,更改上下文:

    据我所知,这导致了 glassfish-web.xml 的生成,这是一开始的问题......

    无论如何,现在它运行时输出惊人:

    thufir@doge:~$ 
    thufir@doge:~$ lynx http://localhost:8080/CRM/crm.xhtml -dump
       some details go here
    
    
    thufir@doge:~$ 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-15
      • 2013-04-18
      • 1970-01-01
      相关资源
      最近更新 更多