[英]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.