Do you know how Netbeans decides which filename to use for the application-scoped resources: sun-resources.xml or glassfish-resources.xml? Is this name configurable or hard-coded?
As far as I understand GlassFish supports sun-resources.xml for backward compatibility. But according to "Application Deployment Guide" preferred filename is glassfish-resources.xml.
I run relatively recent version of Netbeans - 8.0.2 with GlassFish 4.1, but I get generated sun-resources.xml file. This looks odd and confusing.
On the other hand I've seen people having troubles with glassfish-resources.xml: https://netbeans.org/bugzilla/show_bug.cgi?id=243034. And the recommended solution is to rename glassfish-resources.xml to sun-resources.xml - also contradicting with GlassFish recommendations.
Best Regards
First, let's set the expectation that in the Netbeans source, Glassfish is supposed to be able to use both files. The server configuration is generally packaged in the
CommonServerSupport
class.Also, it's not configurable.
From what I can see in the Netbeans source however, the
glassfish-resource.xml
file is never going to be used. Here's why:The default setting should be the
glassfish-resource.xml
, based on what I can infer from thedeployResources()
method. This method in turn depends onregisterResourceDirs()
The problem starts when
succeeded
is never updated totrue
to indicate thatglassfish-resource.xml
was successfully created and should be used.What then ends up happening is that
deployResources()
tries to usesun-resources.xml
anyway, as a fallback:I should mention that this bug was introduced in NB 8.0; 7.3 doesn't appear to have the same problem
For the record, I bumped in the same problem while going through the AffableBean tutorial with NetBeans 8.2 and Glassfish 5.0.
It appears that the glashfish-resources.xml file has been by default created under the web/WEB-INF folder. It is then ignored by Glassfish during the deploy phase.
Moving the file under the /setup directory via the "Files" window solve the problem and the resource and pool are created after a deploy launched via NetBeans.