简体   繁体   中英

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

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. It forces it to be sun-web.xml which is an old legacy format. I'm trying to use 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.

You can manually create a new xml file named glassfish-web.xml (or rename the sun-web.xml ) and insert the following content:

<?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.

I had the same issue. I had resolved it.

It seems bundled GlassFish is wrong. You should download the GlassFish4.1 Full version and replace the bundled GlassFish with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM