[jboss-dev-forums] [JBoss AS 7 Development] - Re: jboss cli java client remote command

Julio Saura do-not-reply at jboss.com
Thu Aug 1 04:28:15 EDT 2013


Julio Saura [https://community.jboss.org/people/jsaura] created the discussion

"Re: jboss cli java client remote command"

To view the discussion, visit: https://community.jboss.org/message/830894#830894

--------------------------------------------------------------
hi, first of all thanks for answering

this is my code

i do not enclose all xml conf parse i have done to read controller ip, port , pass etc etc

connection part, working fine

public void setUp() throws Exception {

ctx = org.jboss.as.cli.CommandContextFactory.getInstance().newCommandContext(this.usuario, this.pass.toCharArray());
ctx.connectController(this.ip, Integer.parseInt(this.puerto));

          }


sending command

public void testExecuteCLICommand() throws Exception {
                    String CLIcmd = "ls /host=master/server-config=server-one";

  ModelControllerClient client = ctx.getModelControllerClient();
  ModelNode commandRequest = ctx.buildRequest(CLIcmd);
  ModelNode result;
  result = client.execute(commandRequest);
  System.out.println(result);
  }

this throws this exception


org.jboss.as.cli.operation.OperationFormatException: The command does not translate to an operation request.
          at org.jboss.as.cli.impl.CommandContextImpl.buildRequest(CommandContextImpl.java:955)
          at org.jboss.as.cli.impl.CommandContextImpl.buildRequest(CommandContextImpl.java:916)
          at TestBasicCLI.testExecuteCLICommand(TestBasicCLI.java:105)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

maybe is just i am using the wrong method to send this commands, seems it expects an operation

i also used dmr method

 ModelNode deployRequest = ctx.buildRequest("ls /host=master/server-config=server-one");

no luck either
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/830894#830894]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130801/561d3dc7/attachment.html 


More information about the jboss-dev-forums mailing list