Search code examples
jbossmodulemigrationwildflybuildpath

How to add libraries to Wildfly Application Server using module?


I want to load the Application server Libraries in Java Build Path in Eclipse,

I have 5 applications in Eclipse which shares common libraries, I can't put all the libraries in each project lib folder, so i want to add the libraries in Wildfly Application server using modules.

This is my module.xml file add added the lib at WILDFLY_HOME/modules/system/layers/base/com/mysql/main/mysql-connector-java-5.1.23-bin.jar

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.23-bin.jar" />
    </resources>
    <dependencies>
        <module name="javax.api" />
        <module name="javax.transaction.api" />
    </dependencies>
</module>

After Restarting the server, this module is not loading in Eclipse Build path.
Can any one knows what wrong with this modules ?
In Wildfly I have some predefined modules, those are loading in build path successfully, but user-defined modules are not loading ?
Why ?


Solution

  • Solution found:

    Follow below steps :

    Go To Eclipse > preferences > Server > Runtime Environments > Default Classpath Entries

    Select "Wildfly 8.x Runtime" and add a module

    and click on apply, now rebuild your application and check,

    the library will be added in buildpath by module name.