-
1. Re: EAP 6.1 Accessing CLI programmatically
jaikiran Aug 14, 2013 1:46 AM (in response to foomanchoo)Eric, welcome to the forums.
CLI (Command Line Interface) is a tool to facilitate invoking management operations against a server. It's an alternative to the web console. When you say you want to use the CLI in your application, do you really mean you want to use that CLI (the command line interface) or do you mean that you want to invoke management operations against the server from your application, just like the CLI does?
-
2. Re: EAP 6.1 Accessing CLI programmatically
foomanchoo Aug 14, 2013 3:33 AM (in response to jaikiran)Hi, sorry for the confusion. I meant that I want to invoke management operations against the server from my application.
-
3. Re: EAP 6.1 Accessing CLI programmatically
foomanchoo Aug 15, 2013 4:05 AM (in response to foomanchoo)Digging down into the source code of jboss-as-cli-7.2.0.Final.jar, I see that there are two Namespace enums defined CLI_1_0("urn:jboss:cli:1.0") and CLI_1_1("urn:jboss:cli:1.1"). However, the namespace version in the actual jboss-cli.xml document is urn:jboss:cli:1.2. jboss-as-cli-7.2.0.Final.jar, which I fetch from the maven repository, is not exactly the same version that is running in the appserver, which is jboss-as-cli-7.2.0.Final-redhat-8.jar and contains the correct namespace enum.
So what's up with the discrepency?
-
4. Re: EAP 6.1 Accessing CLI programmatically
jmartisk Aug 15, 2013 6:10 AM (in response to foomanchoo)jboss-as-cli-7.2.0.Final.jar is a jar from JBoss AS 7.2.0.Final.
jboss-as-cli-7.2.0.Final-redhat-8.jar is a jar from the enterprise edition - JBoss EAP 6.1.0, which is way newer than JBoss AS 7.2.0.Final and contains a newer version of the XML schema (urn:jboss:cli:1.2). And you're trying to use the old JAR with the new schema.
I suppose you are running that code from within JBoss EAP? If yes, you can just add a dependency to the org.jboss.as.cli module for your deployment (either through MANIFEST.MF or jboss-deployment-structure.xml).. then, the jboss-as-cli-7.2.0.Final-redhat-8.jar will be on the classpath for your application and you don't need to add any dependency added through maven or whatever else you are using. If you want to add the CLI dependency through maven, you need to depend on jboss-as-cli-7.2.0.Final-redhat-8.jar (which is not available in public repositories, so you need to use the zipped repo distributed with EAP).
-
5. Re: EAP 6.1 Accessing CLI programmatically
foomanchoo Aug 15, 2013 6:24 AM (in response to jmartisk)Yep, realized that I was using 7.2.0.Final. Changed the version to 7.2.0.Final-redhat-8 and now it works. Thanks.
-
6. Re: EAP 6.1 Accessing CLI programmatically
delphinus818 Jun 6, 2017 8:34 PM (in response to jmartisk)I tried your suggestion of using jboss-deployment-structure.xml to specify org.jboss.as.cli as a module and exclude all dependencies. I got the following error, do you know why? I'm using Wildfly 10.0.0.
CliInitializationException : org.jboss.as.cli.CliInitializationException: Failed to load org.jboss.as.cli.impl.CommandContextFactoryImpl
at org.jboss.as.cli.CommandContextFactory.getInstance(CommandContextFactory.java:43)