In my case I forgot to give the authentication information user/password:
try
{
ctx = org.jboss.as.cli.CommandContextFactory.getInstance().newCommandContext(user, password);
ctx.connectController(host, port);
} catch (Exception e)
{
throw e;
}
works fine for me.
Regards Ines