This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It is depending on implementation detail of the j2eeserver (how it is storing its instance). This will be probably changed in future (any implementation detail can be changed any time). Either you should propose some api or (if applicable) define some kind of contract with glassfish directly. Otherwise you code will stop work unexpectedly one day and it will have to be rewritten.
Agreed. If I remember correctly, the reason we have to rely on this implementation detail is that we can't use the MBeanServerConnection from the j2eeserver directly due to some classpath issue. Also, we have to support deploying/testing composite application projects outside of NetBeans, in which case we probably don't have easy access to the j2eeserver API. We will revisit this issue after 6.1 release.