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 context menu), it doesn't give me the option to change the filename xml

. This makes it be sun-web.xml

, which is the old legacy format. I am trying to use glassfish-web.xml

.

How can I get it to add the correct file?

+3


source to share


2 answers


This should work if you are using Netbeans 8. If you are using an older version of Netbeans, you must update to the latest version.

You can manually create a new XML file named glassfish-web.xml

(or rename 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 that Netbeans creates by default.

+4


source


I had the same problem. I solved it.



The GlassFish bundle seems to be wrong. You must download the full version of GlassFish 4.1 and replace it with the GlassFish bundle.

+1


source







All Articles