2013-12-09 43 views
0

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

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

不过,我看不到任何方式实际上告诉的asadmin如何说话,而不是在这种情况下,默认域,Foo以外的领域。为此,我需要知道Foo的管理服务器的端口,并且似乎没有任何方法可以获取该信息。我理论上可以解析Foodomain.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并提取端口。这是一个可怕的解决方案,所以我将问题留给公众看,看看有没有更好的办法。

回答

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

+0

不幸的是在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

相关问题