4 Replies Latest reply: Feb 23, 2012 10:50 AM by Emanuel Muckenhuber RSS

CLI script samples?

Noel Rocher Newbie

Hi,

I'm looking for some examples in order to be able to script these actions:

  • create a group
  • create servers
  • deploy a webapp to the group
  • start all servers in the group

 

Any pointers?

  • 1. Re: CLI script samples?
    Hamza ben Newbie

    Hi,

     

    • To add a group of servers named test with the ha profile for example, the command is /server-group=test:add(profile=ha,socket-binding-group=ha-sockets)
    • To add a server to the created group on HC1 : /host=HC1/server-config=server1:add(group=test,auto-start=true,socket-binding-port-offset=0)
    • To start the server group : /server-group=test:start-servers, however it crashes with the 7.1.0.final (see trace [1] hereafter). An alternative would be to start the servers individually : /host=HC1/server-config=server1:start.
    • To deploy an application : Execute the command : deploy path/to/your.war --server-groups=test


    Trace [1]

     

    trace => {

        "outcome" => "failed",

        "failure-description" => {"domain-failure-description" => "JBAS014749: Operation handler failed: null"},

        "rolled-back" => true

    }

     

     

     

     

    [Host Controller] 17:15:17,511 ERROR [org.jboss.as.controller.management-operation] (management-handler-threads - 63) JBAS014612: Operation ("start-servers") failed - address: ([("server-group" => "test")]): java.lang.IllegalArgumentException

    [Host Controller]           at org.jboss.dmr.ModelValue.asPropertyList(ModelValue.java:100) [jboss-dmr-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

    [Host Controller]           at org.jboss.dmr.ModelNode.asPropertyList(ModelNode.java:360) [jboss-dmr-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$AbstractHackLifecyleHandler.getServersForGroup(DomainServerLifecycleHandlers.java:119) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$StartServersLifecycleHandler$1.execute(DomainServerLifecycleHandlers.java:186) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$StartServersLifecycleHandler.execute(DomainServerLifecycleHandlers.java:202) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.coordination.DomainFinalResultHandler.execute(DomainFinalResultHandler.java:74) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.coordination.OperationCoordinatorStepHandler.executeTwoPhaseOperation(OperationCoordinatorStepHandler.java:225) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.coordination.OperationCoordinatorStepHandler.execute(OperationCoordinatorStepHandler.java:118) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.domain.controller.operations.coordination.PrepareStepHandler.execute(PrepareStepHandler.java:85) [jboss-as-host-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:121) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:139) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:108) [jboss-as-controller-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:287) [jboss-as-protocol-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:483) [jboss-as-protocol-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

    [Host Controller]           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29]

    [Host Controller]           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29]

    [Host Controller]           at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]

    [Host Controller]           at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA-redhat-1.jar:2.0.0.GA-redhat-1]

    [Host Controller]

     

  • 2. Re: CLI script samples?
    Emanuel Muckenhuber Master

    Hmm, this seems to be an issue if there are no servers defined. I am going to fix that, Thanks.

  • 3. Re: CLI script samples?
    Noel Rocher Newbie

    It seems to be worse than that. Using CLI, I'm defining a server in a group and then start the group. It fails:

     

    /host=HC1/server-config=s1:add(group=test,socket-binding-port-offset=0)

    {

        "outcome" => "success",

        "result" => undefined,

        "server-groups" => undefined

    }

    [domain@192.168.100.100:9999 /] /server-group=test:start-servers

    {

        "outcome" => "failed",

        "failure-description" => {"domain-failure-description" => "JBAS014749: Operation handler failed: null"},

        "rolled-back" => true

    }

    [domain@192.168.100.100:9999 /]

    with stack trace:

     

    [Host Controller] 14:49:59,964 ERROR [org.jboss.as.controller.management-operation] (management-handler-threads - 21) JBAS014612: Operation ("start-servers") failed - address: ([("server-group" => "test")]): java.lang.IllegalArgumentException

    [Host Controller]       at org.jboss.dmr.ModelValue.asPropertyList(ModelValue.java:100) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final]

    [Host Controller]       at org.jboss.dmr.ModelNode.asPropertyList(ModelNode.java:360) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final]

    [Host Controller]       at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$AbstractHackLifecyleHandler.getServersForGroup(DomainServerLifecycleHandlers.java:119) [jboss-as-host-controller-7.1.0.Final.jar:7.1.0.Final]

    [Host Controller]       at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$StartServersLifecycleHandler$1.execute(DomainServerLifecycleHandlers.java:186) [jboss-as-host-controller-7.1.0.Final.jar:7.1.0.Final]

    [Host Controller]       at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

    [Host Controller]       at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

    [Host Controller]       at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

    [Host Controller]       at org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers$StartServersLifecycleHandler.execute(DomainServerLifecycleHandlers.java:202) [jboss-as-host-controller-7.1.0.Final.jar:7.1.0.Final]

    ...

  • 4. Re: CLI script samples?
    Emanuel Muckenhuber Master

    Yeah, that is the issue. Although it might only break if there are no servers configured on the DC.

     

    I created https://issues.jboss.org/browse/AS7-3886 and submitted a pull-request which should fix that. Thanks for spotting that.