[英]Programmatically administer Glassfish domain
I need to start, stop, set options on, etc. a glassfish domain in a programmatic way. 我需要以编程方式启动,停止,设置选项,等等。 The only resource I necessarily have available is
asadmin
. 我唯一需要的可用资源是
asadmin
。 Hence I can 因此我可以
$ asadmin list-domains
Foo running
domain1 not running
Command list-domains executed successfully.
However, I can't see any way to actually tell asadmin how to talk to a domain other than the default domain, Foo
in this case. 但是,我看不到有什么方法可以真正告诉asadmin如何与默认域(在这种情况下为
Foo
以外的域进行通信。 To do so I need to know the port of Foo
's administration server, and there doesn't seem to be any way to get that information. 为此,我需要知道
Foo
的管理服务器的端口,并且似乎没有任何方法可以获取该信息。 I could theoretically parse Foo
's domain.xml
, but to do that I need to know where it is. 从理论上讲,我可以解析
Foo
的domain.xml
,但是要做到这一点,我需要知道它在哪里。
Ideally there'd be an asadmin
option like --domain Foo
, or at least a way to get Foo
's port or directory, but I can't seem to find anything along those lines. 理想情况下,应该有
--domain Foo
类的asadmin
选项,或者至少是一种获取Foo
的端口或目录的方法,但是我似乎找不到任何东西。
Advice appreciated... 意见表示赞赏...
$ 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.
UPDATE: For now I'm using the filthy hack of determining the location of domain.xml via which asadmin
and chopping up the path. 更新:目前,我正在使用肮脏的技巧来确定domain.xml的位置(通过
which asadmin
并切断路径)。 Then I parse the xml and extract the port. 然后,我解析xml并提取端口。 This is a terrible solution, so I'm leaving the question open to see if there's anything better.
这是一个糟糕的解决方案,所以我让问题悬而未决,看看是否还有更好的解决方案。
Most of the asadmin
commands have the target
option which is nearly the same as you want. 大多数
asadmin
命令具有target
选项,该选项几乎与您想要的相同。
For example the command list-javamail-resources
has the following syntax: list-javamail-resources [--help] [target]
例如,命令
list-javamail-resources
具有以下语法: list-javamail-resources [--help] [target]
with the following operands: 具有以下操作数:
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.
For a detailed overview of command operands and parameters see the oracle documentation . 有关命令操作数和参数的详细概述,请参见oracle文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.