7 Replies Latest reply on Apr 4, 2017 3:48 PM by hemanthkolla

    how to load spring libs as modules in wildfly ?

    samalaraj72

      hi am running spring application in JBoss 6, my application jar files are placed in JBoss6/default/deploy/lib folder,

      Now am migrating my server to Wildfly 8, now i can't place these jar's in lib, as i knew that i need to configure jar's as module in wildfly,

      but am unable to do this, i've followed the wildfly doumentation, but it's not clear,

      can any one tell me about configuring jar's in wildfly as module and configuring XML files in Application, etc, ??

        • 1. Re: how to load spring libs as modules in wildfly ?
          abhinav.gupta01

          Hi,

          Below is example from my custom module I create to keep oracle driver jar :

          I created on directory under wildfly modules as  system\layers\base\com\oracle\ojdbc14\main


          Now put all your jars in this directory. Add one module.xml file in same directory with entries of your jar files :


          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc14">

          <resources>

          <resource-root path="ojdbc14.jar"/>

          <resource-root path="second jar"/>

          <resource-root path="third jar "/>

          ..

          ..

          ..

          </resources>

          <dependencies>

          </dependencies>

          </module>

           

          pay attention , I keep my directory structure consistent to my Name property in module. You can add as many jars as you need to this directory and add entry for resource-root path

           

          Now to use this module , you can add entry in jboss-deployment-structure.xml in your applications META-INF , like :

           

          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

              <deployment>

                  <dependencies>

                        ..

          ..

          ..

           

                          <module name = "com.oracle.ojdbc14"/>

                  </dependencies>

          ..

          ..

          ..

          </jboss-deployment-structure>

           

          Hope this helps

           

          -Abhinav

          1 of 1 people found this helpful
          • 2. Re: how to load spring libs as modules in wildfly ?
            samalaraj72

            Hi Abhinav,

             

            Thanks for reply,

            i've added the jar's as module and configured module name in jboss-deployment-structure.xml file too.

            here am attaching screenshot. my jar name is ojdbc14.jar

            unable to load jars in wildfly buildpath.jpg

            but am not loading jar in build path of server.

            can you guide me,how to get my jar in build path, do we need any special configuration in wildfly apart above solution ?

            • 3. Re: how to load spring libs as modules in wildfly ?
              abhinav.gupta01

              Can you explain issue a bit more ?

              " my jar name is ojdbc14.jar" >>  I think you mistype here. ? Please confirm.

               

              You getting exceptions while running your application ? If yes please post trace.

               

              If you mean you dont see that jar , in eclipse classpath , that Ok.. module we created will be available in classpath at runtime.

              • 4. Re: how to load spring libs as modules in wildfly ?
                samalaraj72

                hi,

                am not getting any exceptions,

                i've configured everything, but am unable to use the classes in lib as that lib is not listed in java build path.

                • 5. Re: how to load spring libs as modules in wildfly ?
                  abhinav.gupta01

                  If you need them for compile time dependency , then you need to add them manually , as far as I think.

                  Because adding modules to wildfly just resolve runtime denpendencies

                  2 of 2 people found this helpful
                  • 6. Re: how to load spring libs as modules in wildfly ?
                    samalaraj72

                    Hi Abhinav, Thanks for the help,it's working now.

                    • 7. Re: how to load spring libs as modules in wildfly ?
                      hemanthkolla

                      Abhinav,

                                       Do you think adding all the jar files to one Module will help in resolving internal dependencies? I have 50 some jar files which are needed at run time and they have some internal dependencies.

                       

                       

                      Thanks,

                      Hemanth K