我现在正在使用Glassfish 3.1.2.2和Netbeans 7.3.1在Windows 7匈牙利语。
我创建了以下简单的glassfish-resource.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<custom-resource res-type="java.util.Properties"
jndi-name="iOIRConfig"
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory"
description="iOIR konfigurációs beállítások">
<property name="dev" value="false"></property>
</custom-resource>
</resources>
仔细查看说明元素 - 我使用了重音匈牙利语字符 - 因为这将成为我的问题和此问题排查过程中的焦点。
值得一提的是,在此实验之前,glassfish和netbeans环境是完美的,因此我可以从命令行和netbeans开始,停止,部署。 XML在结构和字符集方面也非常出色。
所以现在我尝试使用asadmin命令将这个小资源添加到我的干净glassfish域中:
asadmin add-resources src\main\config\glassfish-resources.local.xml
这是结果:
remote failure: add-resources <glassfish-resources.local.xml> failed
Attribute "description" must be declared for element type "custom-resource".
Command add-resources failed.
我已经使用适当的ASCII字符修改了每个带重音的章程:
...
<custom-resource res-type="java.util.Properties"
jndi-name="iOIRConfig"
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory"
description="iOIR konfiguracios beallitasok">
...
结果是一样的:
remote failure: add-resources <glassfish-resources.local.xml> failed
Attribute "description" must be declared for element type "custom-resource".
Command add-resources failed.
所以我对XML做了一个小修改:
<custom-resource res-type="java.util.Properties" jndi-name="iOIRConfig" factory-class="org.glassfish.resources.custom.factory.PropertiesFactory">
<description>iOIR konfiguracios beallitasok</description>
<property name="dev" value="false"></property>
</custom-resource>
当我尝试使用asadmin add-resource命令添加时,看起来很奇迹,结果很好:
Command : Custom Resource iOIRConfig created.
Command add-resources executed successfully.
不,我想将描述修改回如下的重音字符:
<custom-resource res-type="java.util.Properties" jndi-name="iOIRConfig" factory-class="org.glassfish.resources.custom.factory.PropertiesFactory">
<description>iOIR konfigurációs beállítások</description>
<property name="dev" value="false"></property>
</custom-resource>
当然我在再次应用add-resource命令之前删除了资源。结果也很好所以想要从netbeans中看到一些部署。
netbeans的行为令人沮丧。它可以从服务面板停止域,但从未再次启动。但是在整个实验过程中,使用asadmin启动和停止域是完美的。
我也玩了属性的描述部分。我添加了更多属性来尝试发生的事情。
add-resource命令也很敏感,我如何声明属性的描述部分,但在属性我可以使用重音字符没有任何副作用。但只有这样:
<property name="dev" value="false">
<description>Fejlesztési üzemmód</description>
</property>
我还尝试使用glassfish管理控制台修改自定义资源的描述,以查看是否存在任何差异。不是问题完全一样。
所以我想我总是只使用glassfish-resources.xml定义中的ASCII字符,直到我找到一个正确的答案或有人帮我理解这个非常奇怪的情况。