jbosswildflyweb-deploymentwarapplication-server

Possibility to access wildfly / app server libraries via jboss-deployment-structure.xml?


I have a web application running on a wildfly app server (22.X). It contains a war file which has the ability (besides the actual functionality) to query the wildfly itself for its active running sessions via JMX and display that number on an simple html page. Originally the following dependency was added (via maven) to make this work:

<dependency>
 <groupId>org.jboss.remotingjmx</groupId>
 <artifactId>remoting-jmx</artifactId>
<version>3.0.4.Final</version>

However this dependency brings lots of other transitive dependencies along like jboss-marshalling, xnio, jboss-threads, wildfly-*, (...) - all packages which does exist within the wildfly app server anyway. So I was wondering whether it is possible to use those app server packages instead of bundling it as part of the war. I tried to add the following to the jboss-deployment-structure.xml to the EAR:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
 <deployment>
    <dependencies>
        <system export="true">
            <paths>
                <path name="sun/reflect"/>
            </paths>
        </system>
    </dependencies>
 </deployment>
 <sub-deployment name="service.war">
    <dependencies>
        <module name="org.jboss.remoting3.remoting-jmx" services="import"/>
    </dependencies>
 </sub-deployment>

However it didn't work - as soon as the dependencies were removed from the war file it stopped working. My question:

Is it possible to specify/configure the deployment structure file to allow access to the necessary packages from the application server? (I know that this is a wildfly specific solution but this is intended)


Solution

  • It looks like this module has moved to org.jboss.remoting-jmx. The org.jboss.remoting3.remoting-jmx does export the org.jboss.remoting-jmx module in WildFly 22, however the services are not exported which could be the issue.

    Either way, it's best to use the org.jboss.remoting-jmx.