[jboss-dev-forums] [JBoss AS 7 Development] - JBoss AS7 Command-line public API

idannehl do-not-reply at jboss.com
Thu Jun 28 04:58:43 EDT 2012


idannehl [https://community.jboss.org/people/idannehl] commented on the document

"JBoss AS7 Command-line public API"

To view all comments on this document, visit: https://community.jboss.org/docs/DOC-17597#comment-10147

--------------------------------------------------
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
--------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120628/0e94b669/attachment.html 


More information about the jboss-dev-forums mailing list