0 Replies Latest reply on Nov 9, 2016 9:50 AM by Richard Baldauf

    How to load a Module in the same Classloader as a Deployment?

    Richard Baldauf Newbie



      I try to migrate our Web Applications from Websphere Application Server to Wildfly. It all works fine. Only one thing is that will stop the migration.

      We have 150 Different WAR Files which used on the Websphere Application Server the same Shared Library (is a collection of jars which can be used by a deployment). For these Shared Libraries it was possible that they were loaded with same classloader as the WEB-INF/classes und WEB-INF/lib resources. So we don't needed the jars in the WEB-INF/lib Folder. They were on each server only one time. If we don't have this feature on wildfly we have to place in the WEB-INF/lib folder the jars and this isn't our prefered solution.


      I'm searching for a solution which would do the same for Wildfly. I tried to define a module for the Jars but that would only work if one deployment will use this module. If I have more deployments on the same wildfly instance it doesn't work.

      Is there a way to load the module or Jars in the same classloader as the war resources?


      I read the article Class Loading in WildFly - WildFly 10 - Project Documentation Editor but there I couldn't find a solution for our problem.


      I tried to define a module with the same jars in jboss-deployment-structure.xml of every war file, but this didn't work cause of the VFS I get the this error message:

      Caused by: java.io.IOException: VFS000017: Filesystem already mounted at mount point ""/path/to/the/jar/file.jar""
          at org.jboss.vfs.VFS.mount(VFS.java:123)
          at org.jboss.vfs.VFS.doMount(VFS.java:336)
          at org.jboss.vfs.VFS.mountZip(VFS.java:386)
          at org.jboss.vfs.VFS.mountZip(VFS.java:410)
          at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser13.parseResourceRoot(JBossDeploymentStructureParser13.java:770)
          ... 16 more


      I hope somebody here can help me.