11 Replies Latest reply on Sep 24, 2012 7:20 AM by nickarls

    JBoss AS 7 - common jar location

    tpedone

      Where in the jboss as7 dir should we put jars that we want to share amongst our apps (ie. analogous to the common/lib dir in AS 5)?  I've tried putting them in standalone/lib and standalone/deployments but neither seems to work.

       

      Thanks,

       

      Tim

        • 1. JBoss AS 7 - common jar location
          alesj
          Where in the jboss as7 dir should we put jars that we want to share amongst our apps (ie. analogous to the common/lib dir in AS 5)?  I've tried putting them in standalone/lib and standalone/deployments but neither seems to work.

          There is *no* such dir anymore in AS7.

          The AS7 uses fully modular system based on JBoss Modules.

           

          What you can do is create a Module, and place it into modules/.

          Then simply reference that newly created module from you app(s).

           

          * http://in.relation.to/Bloggers/ModularizedJavaWithJBossModules

          • 2. Re: JBoss AS 7 - common jar location
            wolfc

            To reference it from your app add the following to MANIFEST.MF:

            Dependencies: my.module
            

             

            Maybe we should define a module "user.global" and implicitly add that to all deployments?

            It's counterintuitive to modularization, but makes migrations easier.

            1 of 1 people found this helpful
            • 3. JBoss AS 7 - common jar location
              tpedone

              While I see a lot of value in the JBoss Modules design, I do think it would be great to provide some backwards compatibility as well.  I think it's a fairly common pattern, especially if you are deploying a jar file where you can't bundle third party jars like you can with a war or ear.

              • 4. JBoss AS 7 - common jar location
                tpedone

                The third party component I'm working with is Spring which is actually packaged with OSGi bundle info in it's manifest.mf.  I assume that I can drop this and any dependencies that are also OSGi bundles into the bundles dir instead of the modules dir so I don't have to create a module.xml file.  If that's the case, do I simply use the OSGi notation in my jar's manifest.mf or does JBoss Modules turn any OSGi bundles into a module so I can use the Dependencies: notation in my manifest.mf?

                • 5. Re: JBoss AS 7 - common jar location
                  sabbirali

                  I also have same problem, if i have 100 jar file then we have create 100 module or create 1 module and put all jar in it.

                  we are also migrating from jboss 5 to 7 so if you have any solution for this please specify.

                   

                  And also i read from some blog we can deploy jar directly at standalone\deployments\ folder, i have put all jar there also but its not working.

                   

                  and if that is only solution then they are not maintaining j2ee standard, we have to put all library in lib folder of WEB-INF/lib ??

                  • 6. Re: JBoss AS 7 - common jar location
                    jaikiran

                    sabbirali kadiwala wrote:

                     

                    I also have same problem, if i have 100 jar file then we have create 100 module or create 1 module and put all jar in it.

                    we are also migrating from jboss 5 to 7 so if you have any solution for this please specify.

                     

                    You don't have to create those many modules. Just package them within your application at the spec specified location (example: .war/WEB-INF/lib).

                    • 7. Re: JBoss AS 7 - common jar location
                      sabbirali

                      Thanx its working now....

                      • 8. Re: JBoss AS 7 - common jar location
                        sabbirali

                        I have one question ?

                        My EAR Structure like below

                        - Common.jar [include common jar]

                        - EJBJar.jar [include ejb jar]

                        - WebApp.war [include web jar]

                         

                        so do i need to create module for common.jar and ejbjar.jar's library ?

                         

                        EJBJar and WebApp are dependant on Common.

                        WebApp is deoendant on EJBJar and Common.

                        • 9. Re: JBoss AS 7 - common jar location
                          jaikiran

                          sabbirali kadiwala wrote:

                           

                          I have one question ?

                          My EAR Structure like below

                          - Common.jar [include common jar]

                          - EJBJar.jar [include ejb jar]

                          - WebApp.war [include web jar]

                           

                          so do i need to create module for common.jar and ejbjar.jar's library ?

                           

                          No, you don't have to create any modules. All you need is a Java EE spec specified packaging like this:

                           

                          .ear
                             |
                             |---- lib
                             |      |---- common.jar
                             |
                             |---- webapp.war
                             |
                             |---- ejbjar.jar
                          
                          • 10. Re: JBoss AS 7 - common jar location
                            mcanpuneet

                            I am facing some different issue. I am having one common jar with name "values.jar" and this jar is used by multiple web applications deployed on same server.

                             

                            Please provide me inputs to resolve this at my end.

                            • 11. Re: JBoss AS 7 - common jar location
                              nickarls

                              Puneet Bansal wrote:

                               

                              I am facing some different issue. I am having one common jar with name "values.jar" and this jar is used by multiple web applications deployed on same server.

                               

                              Please provide me inputs to resolve this at my end.

                               

                              You might want to start a separate topic if you need help but check https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 for info on custom modules