8 Replies Latest reply on Jun 29, 2012 8:56 AM by sfcoy

    How to set the jar loading order in the lib directory

    coolsky

      I am wanting to make the classes or jars in the ear\lib directory loaded in an order in JBoss 7. Is there a way to do this?

        • 1. Re: How to set the jar loading order in the lib directory
          jaikiran

          Why do you want to order it?

          • 2. Re: How to set the jar loading order in the lib directory
            coolsky

            Because I want to put a class file in a classes folder in the lib folder so that there is no need to package the class into a jar, and the most important (for me) is the class file needs to be loaded before the old one packaged in the jar.

             

            Based on this, I can deploy updated class files into the classes folder and let JBoss read them first (this is called a patch to my project..) I was doing this in older version JBoss.

            • 3. Re: How to set the jar loading order in the lib directory
              jaikiran

              sky cool wrote:

               

              Because I want to put a class file in a classes folder in the lib folder so that there is no need to package the class into a jar, and the most important (for me) is the class file needs to be loaded before the old one packaged in the jar.

               

              So you want to package more than one version of the same class in multiple locations within the same application? Anyway, having the in the classes folder and then expecting the newer version of the class to be picked up would still require a redeployment of the application.

              • 4. Re: How to set the jar loading order in the lib directory
                coolsky

                Sorry, I think I have explained to the wrong direction. What actually I meant is to let JBoss load the class file only in the classes folder instead of the same one existing in a jar, so that I can achieve the patch target.

                • 5. Re: How to set the jar loading order in the lib directory
                  coolsky

                  jaikiran pai 编写:

                   

                  sky cool wrote:

                   

                  Because I want to put a class file in a classes folder in the lib folder so that there is no need to package the class into a jar, and the most important (for me) is the class file needs to be loaded before the old one packaged in the jar.

                   

                  So you want to package more than one version of the same class in multiple locations within the same application? Anyway, having the in the classes folder and then expecting the newer version of the class to be picked up would still require a redeployment of the application.

                  Correct, I am having different versions of class files in classes folder and in a jar. Now I am wanting JBoss to load the newer version one in the classes folder instead of the old one in the jar.

                   

                  Can JBoss 7 do this?

                  • 6. Re: How to set the jar loading order in the lib directory
                    ohmygod

                    I am having exactly the same issue: wanting to load the class files in a separate folder instead of loading them in a jar so that we can easily apply any patch (with class files only) to upgrade or hotfix our server.

                     

                    Could anybody suggest if there is a way to do this in JBoss 7? I am using JBoss 7.1.1.Final version.

                    • 7. Re: How to set the jar loading order in the lib directory
                      ohmygod

                      If somebody here can confirm so far JBoss 7.1.1 cannot do this, I will turn to quit using the patch method for upgrading the server and start updating the jar to do the upgrade, thought it will be a little more complicated than using the class files. Thanks so much.

                      • 8. Re: How to set the jar loading order in the lib directory
                        sfcoy

                        Patching applications like this is incredibly evil and should be avoided at all costs. The main reason for this is that it is very easy to get into a situation where you have a production application that cannot be recreated in the event of a disaster.

                         

                        It is highly worthwhile developing a repeatable build process the generates complete deployable and versioned artifacts. Many developers (including myself, the JBoss developers and may others) use Apache Maven for this purpose, often in conjuction with Hudson/Jenkins.