我需要以编程方式启动,停止,设置Glassfish域等选项。我必须拥有的唯一资源是asadmin
。因此,我可以以编程方式管理Glassfish域
$ asadmin list-domains
Foo running
domain1 not running
Command list-domains executed successfully.
不过,我看不到任何方式实际上告诉的asadmin如何说话,而不是在这种情况下,默认域,Foo
以外的领域。为此,我需要知道Foo
的管理服务器的端口,并且似乎没有任何方法可以获取该信息。我理论上可以解析Foo
的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.
UPDATE:现在我通过which asadmin
使用domain.xml的确定的位置的污秽黑客和切碎了的路径。然后我解析XML并提取端口。这是一个可怕的解决方案,所以我将问题留给公众看,看看有没有更好的办法。
不幸的是在glassfish 3.1.2目标选项不会将域作为我检查过的任何命令的参数([示例](http://docs.oracle.com/cd/E26576_01/doc.312 /e24938/create-jvm-options.htm#create-jvm-options-1))。它似乎在3.1.1中被弃用,并在3.1.2中被删除,也许? – elhefe