NetBeans - “sun-resources.xml” vs. “glassfish-resources.xml”

两盒软妹~` 提交于 2019-12-01 17:23:20

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:

  1. The default setting should be the glassfish-resource.xml, based on what I can infer from the deployResources() method. This method in turn depends on registerResourceDirs()

  2. The problem starts when succeeded is never updated to true to indicate that glassfish-resource.xml was successfully created and should be used.

  3. What then ends up happening is that deployResources() tries to use sun-resources.xml anyway, as a fallback:

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!