Check available services with WildFly
WildFly Services are classes which implement the interface org.jboss.msc.service.Service:

In order to query for active services from the CLI you can query the service-container as follows:
/core-service=service-container:dump-services()
As the list can be quite verbose, you can launch the CLI command in combination with the grep command from the shell. Here’s for example how to query for the jgroups service to be active:
$ ./jboss-cli.sh --connect --command="/core-service=service-container:dump-services()" | grep jgroups
As an alternative, you could query the MBean jboss.msc:type=container,name=jboss-as via JMX as in the following example:

If you want to query the status programmatically, here’s an example which shows how to query for the infinispan.server service using the getServicesStatus method:
JMXServiceURL address = new JMXServiceURL("service:jmx:remote+http://localhost:9990");
connector = JMXConnectorFactory.connect(address, null);
connection = connector.getMBeanServerConnection();
System.out.println("Connected to MBean Server");
ObjectName mbeanName = new ObjectName("jboss.msc:type=container,name=jboss-as");
// Invoke operation
String opParams[] = {"jboss.infinispan.server"};
String opSig[] = {java.lang.String.class.getName()};
javax.management.openmbean.CompositeDataSupport out = (javax.management.openmbean.CompositeDataSupport) connection.invoke(mbeanName, "getServiceStatus", opParams, opSig);
System.out.println(out.get("stateName"));
Recommended Articles
Monitor WildFly with CLI and Bash: A Simple Approach to Application Server Monitoring
Learn how to monitor your WildFly application server using only Java Management Extensions (JMX) CLI, bash, and awk. Automate alerts for key attributes like available connections and free heap memory.
Deploy and Access JMX MBeans with Jolokia on JBoss AS 7 - A Comprehensive Tutorial
Learn how to deploy and access JMX MBeans using Jolokia on JBoss AS 7. Deploy the WAR Agent, test connectivity, and explore more complex requests.
Monitor WildFly Cluster with WildFly API: A Step-by-Step Guide to JGroups Channels
Learn how to monitor a WildFly cluster using the WildFly API and JGroups channels. Get started with this tutorial to gather information about your cluster topology and receive notifications when nodes join or leave.
Collecting JBoss AS Snapshots: A Guide for Old Versions
Learn how to collect snapshots with JBoss AS 5 using the JMX-Console. Updated resources for WildFly or JBoss EAP 7.