简体   繁体   English

无法在我的Web项目中创建glassfish-web.xml(Glassfish / Netbeans)

[英]Can't create glassfish-web.xml in my web project (Glassfish/Netbeans)

I have a Java project that uses Java EE 7 and Glassfish 4.1 我有一个使用Java EE 7和Glassfish 4.1的Java项目

When I add a new Glassfish Descriptor to the project (via the right-click menu), it doesn't give me the ability to change the name of the xml file. 当我向项目中添加一个新的Glassfish Descriptor时(通过右键单击菜单),它不能让我能够更改xml文件的名称。 It forces it to be sun-web.xml which is an old legacy format. 它强制它是sun-web.xml ,这是一种旧的遗留格式。 I'm trying to use glassfish-web.xml . 我正在尝试使用glassfish-web.xml

How can I make it add the correct file? 如何让它添加正确的文件?

This should work if you are using Netbeans 8. If you are using an older version of Netbeans you should update to the latest version. 如果您使用的是Netbeans 8,这应该可以使用。如果您使用的是旧版本的Netbeans,则应该更新到最新版本。

You can manually create a new xml file named glassfish-web.xml (or rename the sun-web.xml ) and insert the following content: 您可以手动创建名为glassfish-web.xml的新xml文件(或重命名sun-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="">
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
    </property>
  </jsp-config>
</glassfish-web-app>

This is the content Netbeans creates by default. 这是Netbeans默认创建的内容。

I had the same issue. 我遇到过同样的问题。 I had resolved it. 我已经解决了。

It seems bundled GlassFish is wrong. 似乎捆绑GlassFish是错误的。 You should download the GlassFish4.1 Full version and replace the bundled GlassFish with it. 您应下载GlassFish4.1完整版并将捆绑的GlassFish替换为它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Netbeans创建的项目没有glassfish-web.xml - Netbeans created project has no glassfish-web.xml Eclipse - Glassfish 5 - glassfish-web.xml 中的错误 - Eclipse - Glassfish 5 - Error in glassfish-web.xml 无法使用glassfish web配置文件构建netbeans企业项目 - Can't build netbeans enterprise project with glassfish web profile 如何为JSF配置web.xml,glassfish-web.xml文件? - How to configure web.xml, glassfish-web.xml files for JSF? 无法使用 IntelliJ IDEA 运行 Web 应用程序项目 | 玻璃鱼 - Can't Run the Web Application Project using IntelliJ IDEA | Glassfish 使用auth-method = CLIENT-CERT时如何避免在glassfish-web.xml文件中添加主体? - How to avoid adding principal in glassfish-web.xml file when using auth-method=CLIENT-CERT? 刷新浏览器-Java EE Web应用程序时看不到更改。 + Glassfish 4 + Netbeans + Java 7 + Mac OS- - Can't see the change when i refresh my browser - Java EE web app. + Glassfish 4 + Netbeans + Java 7 + Mac os- 在Netbeans中使用Glassfish 4.1.1运行我的Web应用程序时的警告 - Warnings when running my web app with Glassfish 4.1.1 in Netbeans 无法在Glassfish上部署我的项目 - Can't deploy my project on Glassfish 无法在普通的servlet中进行普通的Web服务[Netbeans,glassfish] - Can't make plain web service work in plain servlet [Netbeans, glassfish]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM