Chapter 10. Common Actions with JBoss ON CLI Scripts

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
    at java.lang.reflect.Proxy.getProxyClass(
    at java.lang.reflect.Proxy.newProxyInstance(

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 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 over port 70443. Because the port number ends with 443, the CLI automatically attempts to connect over SSL. -u rhqadmin -p rhqadmin -s -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. -u rhqadmin -P