0

I've recently started to work on migrating our huge application which contains a an EAR with 40 plus unique individual EJB jar projects, one Web Application and several Java Model projects which contains utilities and helper classes for the application.

We are currently using WebSphere Network Deployment (WAS ND 8.5.5). WAS provides an easy way to define external libraries using Shared Libraries. Though I can very much use WildFly Global Modules to provide all external libraries, we want to do it the right way, viz, using Modules.

Here's what I have tried uptil now:

  1. Defined a custom module.xml inside %%WildFly_Install_Dir%%/modules/gov/abc/def/main and copied the external libraries to see if it picks up during server startup.

    Content of module.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="gov.abc.def">
<resources>
<resource-root path="."/>
</resources>
</module>
  1. Referenced it using MANIFEST.mf inside EAR->META-INF so there are no portability issues in future but even after creating module and referencing the module in MANIFEST.mf of EAR, I keep getting NoClassDefFoundError on deployment.

  2. Then, I tried creating jboss-deployment-structure.xml and create corresponding section to reference the custom module that I created, it didn't work either and same NoClassDefFound Error came.

Can someone please try to help me out on how to achieve modular setup and still deploy the application correctly?

Community
  • 1
  • 1
Yogendra
  • 331
  • 5
  • 21

1 Answers1

2

You need to explicitly define each JAR as a <resource-root/>.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="gov.abc.def">
    <resources>
        <resource-root path="some.jar"/>
        <resource-root path="other.jar"/>
    </resources>
</module>
James R. Perkins
  • 16,800
  • 44
  • 60
  • I have more than 160 JAR's. Are you suggesting to add one by one? I thought adding it with "." would take all the libraries in the gov.abc.def folder. – Yogendra Mar 18 '16 at 00:53
  • Yes. I see no way to use a wildcard. Each dependency needs to be listed out. – James R. Perkins Mar 18 '16 at 17:46
  • This solved the problem. I added a global module and referenced the above custom module in standalone.xml. Worked, Thanks. – Yogendra Mar 18 '16 at 22:10