JBoss Community

JBoss AS7 Command-line public API

new comment by idannehl View all comments on this document

Hi,

 

I tried to create a simple standalone Java application which connects remote to the controller:

 

CommandContext ctx = null;

try

{

    ctx = org.jboss.as.cli.CommandContextFactory.getInstance().newCommandContext();

    ctx.connectController(host, port);

} catch (CommandLineException e)

{

     e.printStackTrace();

}

 

Host and port are properly set. I get the following error:

 

WARN: can't load the config file because JBOSS_HOME environment variable is not set.

28.06.2012 08:53:39 org.xnio.Xnio <clinit>

INFO: XNIO Version 3.0.3.GA

org.jboss.as.cli.CommandLineException: The controller is not available at myhost:9999

    at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:639)

    at com.xxx.jboss.DataCollector.createContext(DataCollector.java:58)

    at com.xxx.jboss.DataCollector.main(DataCollector.java:21)

 

I give the JBOSS_HOME environment variable as java option -DJBOSS_HOME=/mypath/JBoss-7.1.1.Final

Why the JBOSS_HOME is not transfered to the application? Is this the reason for the connection error?

 

Any help is welcome.

 

Regards

Ines