NetBeans - “sun-resources.xml” vs.“glassfish-resources.xml” [英] NetBeans - "sun-resources.xml" vs. "glassfish-resources.xml"
问题描述
你知道Netbeans如何决定哪个文件名用于应用程序范围的资源: sun-resources.xml 或 glassfish-resources.xml ?
这个名称是可配置的还是硬编码的?
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?
据了解,GlassFish支持 sun-resources.xml 。但是根据应用程序部署指南的首选文件名是 glassfish-resources.xml 。
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.
我运行的是最新版本的Netbeans - 8.0.2使用GlassFish 4.1,但是我生成了 sun-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.
另一方面,我看到人们在使用glassfish-resources.xml 时遇到麻烦:
https://netbeans.org/bugzilla/show_bug.cgi?id=243034 。
建议的解决方案是将 glassfish-resources.xml 重命名为sun-resources.xml ,也与GlassFish的建议相矛盾。
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.
最好的问候
推荐答案
首先,让我们设定Netbeans来源的期望 Glassfish应该能够使用这两个文件。服务器配置通常打包在 CommonServerSupport
类。
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.
此外,它不可配置。
从Netbeans源代码中可以看到, glassfish-resource.xml
文件永远不会使用。这就是为什么:
From what I can see in the Netbeans source however, the glassfish-resource.xml
file is never going to be used. Here's why:
-
默认设置应该是
glassfish-resource.xml
,根据我可以从deployResources()
方法。这个方法又取决于registerResourceDirs()
The default setting should be the
glassfish-resource.xml
, based on what I can infer from thedeployResources()
method. This method in turn depends onregisterResourceDirs()
问题开始于 成功
从未更新为 true
表示 c $ c> glassfish-resource.xml 已成功创建,应该使用。
The problem starts when succeeded
is never updated to true
to indicate that glassfish-resource.xml
was successfully created and should be used.
最后发生的是 deployResources()
尝试使用 sun-resources.xml
无论如何,作为回退:
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应该提到这个bug是在NB 8.0中引入的 7.3似乎没有相同的问题
I should mention that this bug was introduced in NB 8.0; 7.3 doesn't appear to have the same problem
这篇关于NetBeans - “sun-resources.xml” vs.“glassfish-resources.xml”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!