Targeting a remote instance of Wildfly 10.0.0.CR3 with the CLI client jar (org.wildfly.core:wildfly-cli:2.0.0.CR7:client@jar) in my Gradle build script, I can successfully deploy/undeploy my war. I can successfully add/remove a jdbc-driver definition and a datasource definition.
What I cannot do is execute a 'module add' or 'remove' command via the CLI client jar. I can do both if I'm on the remote machine using the jboss-cli.sh approach, but not remotely via the client jar.
The line of code the causes the problem is this:
cli.cmd('module remove --name=com.microsoft.sqljdbc')
The first problem is that it complains that JBOSS_HOME isn't set. It is set on the remote server, but it is not set on my local machine--which should be completely irrelevant! But if I set JBOSS_HOME on my local machine to match the JBOSS_HOME on the remote machine, I get past that error...
The next error is:
org.jboss.as.cli.CommandLineException: Failed to locate the modules dir on the filesystem: /opt/as/latest/modules
Now, if I execute that exact command using jboss-cli.sh on the remote machine, I get this response:
Failed to locate module com.microsoft.sqljdbc at /opt/as/latest/modules/com/microsoft/sqljdbc/main
Which is exactly what I would expect. And you'll notice that the modules root is exactly where the error says it isn't! Which, again, would only be true if it were looking at my filesystem and not the remote one....
Does the module add/remove behavior just not work remotely? I don't see any such feature in the HTTP management console, so maybe it just isn't supported that way? I couldn't find any better documentation than this.
The module command only works for local installs. There is no way to install a module on a remote server.
James R. Perkins