WildFly Modular Service Container Programmatic Access

From NovaOrdis Knowledge Base
Revision as of 21:26, 1 March 2017 by Ovidiu (talk | contribs) (Created page with "=Internal= * WildFly Modular Service Container =Maven= <pre> <dependency> <groupId>org.jboss.msc</groupId>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

Maven

<dependency>
    <groupId>org.jboss.msc</groupId>
    <artifactId>jboss-msc</artifactId>
    <version>1.1.6.Final-redhat-1</version>
</dependency>

The following is needed for org.jboss.as.server.CurrentServiceContainer:

<dependency>
    <groupId>org.jboss.as</groupId>
    <artifactId>jboss-as-server</artifactId>
    <version>7.5.9.Final-redhat-2</version>
    <scope>provided</scope>
</dependency>

It is particularly important to declare the org.jboss.as.jboss-as-server dependency as provided, and to use the classes deployed within the WildFly instance, because otherwise

ServiceContainer sc = CurrentServiceContainer.getServiceContainer();

will return null.