NetBeans - "sun-resources.xml" and "glassfish-resources.xml"

Do you know how Netbeans decides which file name to use for application resources: sun-resources.xml or glassfish-resources.xml? Is this name customizable or hardcoded?

As far as I understand, GlassFish supports sun-resources.xml for backward compatibility. But according to the Application Deployment Guide, the preferred file name is glassfish-resources.xml.

I am running a relatively recent version of Netbeans - 8.0.2 with GlassFish 4.1, but I am getting the generated sun-resources.xml file. It looks weird and confusing.

On the other hand, I saw people who have problems with glassfish-resources.xml: https://netbeans.org/bugzilla/show_bug.cgi?id=243034 . The recommended solution - rename glassfish-resources.xml to sun-resources.xml - also contradicts GlassFish recommendations.

Best wishes

+6
source share
2 answers

First, let's assume that the source Netbeans Glassfish should use both files . Server configuration is usually packaged in the CommonServerSupport class.

In addition, it is not configurable.

From what I see in the Netbeans source, the glassfish-resource.xml file will never be used. That's why:

  • The default value should be glassfish-resource.xml , based on what I can do from deployResources() . This method, in turn, depends on registerResourceDirs()

  • The problem starts when succeeded never updated to true to indicate that glassfish-resource.xml been successfully created and should.

  • What happens then is that deployResources() tries to use sun-resources.xml as a backup:

     if (!usedNewName) { // try to use sun-resources.xml registerResourceDir(resourceDir,dm,"sun-resources"); // NOI18N } 

It should be noted that this error was introduced in NB 8.0; 7.3 doesn't look like the same problem

+2
source

For the record, I ran into the same issue after going through the AffableBean tutorial using NetBeans 8.2 and Glassfish 5.0.

Looks like the glashfish-resources.xml file was created by default in the web / WEB-INF folder. It is then ignored by Glassfish during the deployment phase.

Moving the file in the / setup directory through the Files window solves the problem, and the resource and pool are created after the deployment launched through NetBeans.

0
source

Source: https://habr.com/ru/post/981819/


All Articles