以编程方式管理Glassfish域

时间:2013-12-09 00:41:38

标签: java glassfish administration

我需要以编程方式启动,停止,设置选项等等。我必须拥有的唯一资源是asadmin。因此,我可以

$ asadmin  list-domains
Foo running
domain1 not running
Command list-domains executed successfully.

但是,在这种情况下,我无法看到任何方法实际告诉asadmin如何与默认域Foo以外的域进行通信。为此,我需要知道Foo管理服务器的端口,似乎没有任何方法可以获取该信息。我理论上可以解析Foo的{​​{1}},但要做到这一点,我需要知道它在哪里。

理想情况下会有一个domain.xml选项,例如asadmin,或者至少是获取--domain Foo端口或目录的方法,但我似乎找不到任何东西那些台词。

建议赞赏......

Foo

更新:目前我正在使用肮脏的黑客通过$ asadmin version Version string could not be obtained from Server [localhost:4848] for some reason. (Turn debugging on e.g. by setting AS_DEBUG=true in your environment, to see the details). Using locally retrieved version string from version class. Version = GlassFish Server Open Source Edition 3.1.2.2 (build 5) Command version executed successfully. 确定domain.xml的位置并切断路径。然后我解析xml并解压缩端口。这是一个可怕的解决方案,所以我将问题留待开来,看看有没有更好的方法。

1 个答案:

答案 0 :(得分:0)

大多数asadmin命令都有target选项,几乎与您想要的一样。

例如,命令list-javamail-resources具有以下语法:list-javamail-resources [--help] [target]

使用以下操作数:

    target

    This operand specifies the target for which the JavaMail session 
    resources are to be listed. Valid values are:

    server
    Lists the resources for the default server instance. This is the default.

    domain
    Lists the resources for the domain.

    cluster_name
    Lists the resources for the specified cluster.

    instance_name
    Lists the resources for a particular server instance.

有关命令操作数和参数的详细概述,请参阅oracle documentation

相关问题