JBoss EAP 7.1.0 connects using cli but fails using CommandContext or ModelControllerClient

451 Views Asked by At

I am trying to execute few commands using cli from java code. For this, I am trying to connect to cli but I am unable to connect.

When i connect using jboss.cli.sh -> connect loclahost:9990, it connects.

When I try this from java using CommandContextFactory, it fails.

CommandContextFactory.getInstance().newCommandContext().connectController()

Exception is:

java.io.IOException: java.net.ConnectException: WFLYPRT0023: Could not connect to remote+http://localhost:9990. The connection timed out

I am getting same exception when I am using

ModelControllerClient.Factory.create("localhost", 9990)

Any pointers as what I might be missing?

-Swaraj

1

There are 1 best solutions below

0
On

The possibility here could be of the timeout By default the cli is configured to check for 5 sec(5000ms) if connection is not established in that phase it throws this. For me it worked when I increased timeout to 20sec(20000)