Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为AdminTask.createCluster命令设置配置参数_Java_Websphere_Java Ee 6_Jmx_Websphere 8 - Fatal编程技术网

Java 为AdminTask.createCluster命令设置配置参数

Java 为AdminTask.createCluster命令设置配置参数,java,websphere,java-ee-6,jmx,websphere-8,Java,Websphere,Java Ee 6,Jmx,Websphere 8,我的问题是定义配置属性: 我得到了这个源代码: Session session = new Session(); ConfigService cService = new ConfigServiceProxy(aClient); CommandMgr cmdMgr = CommandMgr.getCommandMgr(aClient); AdminCommand cmd = cmdMgr.createCommand("createCluster"

我的问题是定义配置属性:

我得到了这个源代码:

            Session session = new Session();
    ConfigService cService = new ConfigServiceProxy(aClient);

    CommandMgr cmdMgr = CommandMgr.getCommandMgr(aClient);
    AdminCommand cmd = cmdMgr.createCommand("createCluster");

    Hashtable<String,Object> myParam = new Hashtable<String, Object>();
    myParam.put("clusterName", ClusterName);
    myParam.put("preferLocal", true);

    cmd.setParameter("clusterConfig", myParam); 

    cmd.setConfigSession(session);
    cmd.execute();

    CommandResult result = cmd.getCommandResult();

    cService.save(session, false);
现在如何设置clusterConfig?我尝试用clustername和preferLocal的值定义哈希表。所以我可以用这个哈希表设置clusterConfig

作为响应,我得到:Excep.:未知参数名clusterConfig

如果setParameter看起来像[-x[-y“value”-z“value2”],有人知道如何设置吗

我尝试此操作以获取此任务的所有参数:

List temp = cmd.listAllParameterName();
结果=列表仍然为空。含糊不清的


谢谢

经过长时间的研究,我找到了解决办法

有一些步骤可以预定义

AdminTask.createCluster('[-clusterConfig [-clusterName test_rpc -preferLocal true]]')
clusterConfig是一个步骤

要定义ClusterConfig,源代码如下所示:

            AdminCommand cmd = cmdMgr.createCommand("createCluster");

            //gotoStep
    CommandStep step = ((TaskCommand) cmd).gotoStep("clusterConfig");

    step.setParameter("clusterName", ClusterName);
    step.setParameter("preferLocal", true);

    cmd.setConfigSession(session);
    cmd.execute();
现在它工作得很好

            AdminCommand cmd = cmdMgr.createCommand("createCluster");

            //gotoStep
    CommandStep step = ((TaskCommand) cmd).gotoStep("clusterConfig");

    step.setParameter("clusterName", ClusterName);
    step.setParameter("preferLocal", true);

    cmd.setConfigSession(session);
    cmd.execute();