12 Replies Latest reply on Sep 9, 2016 4:57 AM by dvrajitha

    Jboss EAP 6.1 classloader

    surendrand001

      Hi,

       

      I have 2 different EJB jar files under an EAR file.

      As per JBoss EAP 6.1, two different classloaders will load my EJB jars.

       

      Is it possible to make a single classloader to load all my EJB jar's inside EAR file.

       

      Regards,

      Surendran

        • 1. Re: Jboss EAP 6.1 classloader
          jaikiran

          What exactly are you trying to do?

          • 2. Re: Jboss EAP 6.1 classloader
            luan.cestari

            By default, all modules (WAR,EJBs,etc) can see each other. Probably this can solve your problem =)

            • 3. Re: Jboss EAP 6.1 classloader
              wdfink
              • 4. Re: Jboss EAP 6.1 classloader
                surendrand001

                I am migrating our application from jboss eap 4 to eap 6.

                got stuck with the problem java.lang.IllegalAccessError Jboss EAP 6.1

                 

                where we have 2 ejb jars inside an ear. with same package names but protected method's

                Since the class loaders are different for each ear, I got IllegalAccessError.

                 

                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated> doesnot help as this issue occurs due to classloading not because of dependancy. Also I cannot cannot change my protected to public due to design constraints in my project.

                 

                Now looking to deploy my EAR in Jboss EAP 6.1 so that a single classloader loads all my EJB jar from my EAR.

                • 5. Re: Jboss EAP 6.1 classloader
                  sfcoy

                  Did you try Java7 as I suggested in the other thread?

                  • 6. Re: Jboss EAP 6.1 classloader
                    surendrand001

                    I tried with Java 7 and still ran into the same exception.

                    • 7. Re: Jboss EAP 6.1 classloader
                      jaikiran

                      Surendran Duraisamy wrote:

                       

                      I am migrating our application from jboss eap 4 to eap 6.

                      got stuck with the problem java.lang.IllegalAccessError Jboss EAP 6.1

                       

                      where we have 2 ejb jars inside an ear. with same package names but protected method's

                      Are those classes EJB components or some plain Java classes used by the EJBs? If it's the latter then you could create a JBoss module and include 2 jars containing those classes as the resource roots of that module. Finally, you can then include that module as a dependency in your application deployment.

                      • 8. Re: Jboss EAP 6.1 classloader
                        jaikiran

                        Infact, you could even create those 2 jars containing the same named package classes and place those jars in the .ear/lib folder.

                        • 9. Re: Jboss EAP 6.1 classloader
                          sfcoy

                          surendrand001 wrote:

                           

                          ...

                          Also I cannot cannot change my protected to public due to design constraints in my project.

                          ...

                          The design constraints are based upon a faulty premise. Unless someone else comes up with another workable solution, you're going to have to bite the bullet and:

                          • Merge the two EJB jars into a single jar

                          or

                          • Change the declarations from protected to public

                           

                          If the particular classes that have the problem are *not* EJBs, then the suggestion by jaikiran is the way to go, because all jars in the EAR/lib directory share the same classloader.

                          • 10. Re: Jboss EAP 6.1 classloader
                            surendrand001

                            I my case both jar files are EJB's. Session bean on jar1 calling entity bean on jar2.

                             

                            Unfortunately I cannot pack them into a single jar also (due to another internal constraint occurred while packing into a single jar ).

                             

                            Is it possible to override the existing jboss behavior(each EJB jar loaded in separate class loader) and modify so that a single classloader loads all my EJB jars. Is it possible achieve this single class loader behavior in Jboss EAP 6, either through any configuration / writing our own classloaders

                            • 11. Re: Jboss EAP 6.1 classloader
                              jaikiran

                              Surendran Duraisamy wrote:

                               

                               

                              Is it possible to override the existing jboss behavior(each EJB jar loaded in separate class loader) and modify so that a single classloader loads all my EJB jars.

                              No, not unless you repackage them.

                               

                              Surendran Duraisamy wrote:

                               

                              Is it possible achieve this single class loader behavior in Jboss EAP 6, either through any configuration / writing our own classloaders

                              I think, along with your team, you might have to review the design/packaging decisions that have been done. Writing custom classloaders or trying to think of other hacky ways to fix this is, is an unnecessarily complicated way to solve this, IMO.

                              • 12. Re: Jboss EAP 6.1 classloader
                                dvrajitha

                                During my migration i came across following error, What could be the issue?

                                 

                                : java.lang.IllegalAccessError: tried to access class org.jboss.seam.log.LogImpl from class org.jboss.seam.log.Logging