Chapter 10. Common Actions with JBoss ON CLI Scripts

IMPORTANT
The remote API cannot be run from a client inside an application server. For example, the remote API cannot be run from a client inside an EAP instance; it fails with errors like the following:
Caused by: java.lang.IllegalArgumentException: interface
    org.rhq.enterprise.server.auth.SubjectManagerRemote is not visible from class
    loader
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
    at
    org.rhq.enterprise.client.RemoteClientProxy.getProcessor(RemoteClientProxy.java:69)

10.1. Logging In

The CLI actually connects to the JBoss ON server, much like connecting through the GUI. This means that you have to log into the server before you can perform most tasks.
There are two ways to log into the server through the CLI:
  • By passing user credentials when the rhq-cli.sh script is run.
  • By using the command in a script or after starting the CLI without connecting to the server.
When logging into the server, other connection information, such as a server name and port number, can be passed with the login command.

Example 10.1. Logging in to a Specified Server

This connects to the CLI and logs into the JBoss ON server on 192.168.1.100 over port 70443. Because the port number ends with 443, the CLI automatically attempts to connect over SSL.
rhq-cli.sh -u rhqadmin -p rhqadmin -s 192.168.1.100 -t 70443

Example 10.2. Prompting for a Password

Instead of sending the password in clear text, it is possible to have the server prompt for a password. This is probably unnecessary when connecting to a server on the local host, but it is useful if the target JBoss ON server is on a different system.
rhq-cli.sh -u rhqadmin -P