9 Replies Latest reply on Jan 20, 2009 10:54 AM by Andrew Rubinger

    Cant load class from one EAR to another

    Thorsten Anzenberger Newbie

      Hello

      We are trying to upgrade from JBoss 4.0.5 GA to 5.0.0 GA.

      We have 3, and in one EAR there is a class which needs to create a class
      which is in a jar in another EAR. In Jboss 4.0.5 everything worked, now
      it seems that classes cant be found over EAR's, just inside each EAR.

      Detailed :

      There are 2 EAR's

      Findok_EJB_Trip.EAR
      Findok_Internet.EAR

      In Findok_Internet.EAR there is a jar "Findok_Internet.Web". In there is a class which needs to create an objekt from which the class lies in
      Findok_EJB_Trip.EAR -> Findok_Controller.jar.

      We get the error : java.lang.NoClassDefFoundError


      Anyone has a hint how we can find a class from one EAR in another ?

      I opend another thread and jaikiran told me to post it here.
      Other thread : http://www.jboss.com/index.html?module=bb&op=viewtopic&t=148450

        • 2. Re: Cant load class from one EAR to another
          Ales Justin Master

           

          "thanz@gmx.at" wrote:
          Nobody has a idea ?

          It's been 3.5h since your initial post.
          I guess this is what you need: http://www.jboss.com/services/index
          A super golden premium support. ;-)

          • 3. Re: Cant load class from one EAR to another
            Vincent MATHON Newbie

            In JBoss 5 ear are deployed in isolation by default (see release notes)
            in deployers/ear-deployer-jboss-beans.xml

            <property name="callByValue">true</property>
            <property name="isolated">true</property>
            


            in 4.0.5 isolated = false, it is probably related

            Vincent

            • 4. Re: Cant load class from one EAR to another
              Ales Justin Master

               

              "vmath" wrote:
              In JBoss 5 ear are deployed in isolation by default (see release notes)
              in deployers/ear-deployer-jboss-beans.xml
              <property name="callByValue">true</property>
              <property name="isolated">true</property>
              


              in 4.0.5 isolated = false, it is probably related

              That's only true for standard server config,
              default still has the same configuration as 4.x - both false.

              • 5. Re: Cant load class from one EAR to another
                Ales Justin Master

                I did a mock of your example and I have no NCDFE problems.
                But I do get other strange behavior - more about this at the bottom.

                My mock's structure:

                a.ear
                * consumer.jar
                ** Consumer (@Service)

                @Service
                public class Consumer implements ConsumerMBean
                {
                 @PostConstruct
                 public void create()
                 {
                 System.out.println(consume("Ales"));
                 }
                
                 public String consume(String name)
                 {
                 return Helper.provide(name);
                 }
                }
                


                b.ear
                * provider.jar
                ** Helper.class

                When I deploy both at the same time:
                15:57:01,281 INFO [STDOUT] Hello, Ales!
                


                So, consumer knows about Helper, although it's in diff ear.

                But what is strange is this - duplicate Consumer initialization.

                15:57:01,031 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@31452591{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:01,031 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@31452591{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:01,046 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@31452591{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:01,046 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@31452591{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:01,046 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@29466827{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:01,046 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@29466827{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:01,046 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@29466827{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:01,093 INFO [JBossASKernel] Created KernelDeployment for: consumer.jar
                15:57:01,093 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=a.ear,jar=consumer.jar,name=Consumer,service=EJB3
                15:57:01,093 INFO [JBossASKernel] with dependencies:
                15:57:01,093 INFO [JBossASKernel] and demands:
                15:57:01,093 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
                15:57:01,109 INFO [JBossASKernel] and supplies:
                15:57:01,109 INFO [JBossASKernel] Class:org.jboss.acme.consumer.ConsumerMBean
                15:57:01,109 INFO [JBossASKernel] jndi:a/Consumer/remote
                15:57:01,109 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=a.ear,jar=consumer.jar,name=Consumer,service=EJB3) to KernelDeployment of: consumer.jar
                15:57:01,281 INFO [STDOUT] Hello, Ales!
                15:57:01,281 INFO [EJBContainer] STARTED EJB: org.jboss.acme.consumer.Consumer ejbName: Consumer
                15:57:01,296 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
                
                
                15:57:06,500 INFO [EJBContainer] STOPPED EJB: org.jboss.acme.consumer.Consumer ejbName: Consumer
                15:57:06,750 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19593740{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:06,750 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19593740{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:06,750 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19593740{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:06,750 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19593740{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/a.ear/consumer.jar/}
                15:57:06,750 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@22474837{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:06,765 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@22474837{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:06,765 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@22474837{vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/b.ear/provider.jar/}
                15:57:06,796 INFO [JBossASKernel] Created KernelDeployment for: consumer.jar
                15:57:06,796 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=a.ear,jar=consumer.jar,name=Consumer,service=EJB3
                15:57:06,796 INFO [JBossASKernel] with dependencies:
                15:57:06,796 INFO [JBossASKernel] and demands:
                15:57:06,796 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
                15:57:06,796 INFO [JBossASKernel] and supplies:
                15:57:06,812 INFO [JBossASKernel] Class:org.jboss.acme.consumer.ConsumerMBean
                15:57:06,812 INFO [JBossASKernel] jndi:a/Consumer/remote
                15:57:06,812 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=a.ear,jar=consumer.jar,name=Consumer,service=EJB3) to KernelDeployment of: consumer.jar
                15:57:06,843 INFO [STDOUT] Hello, Ales!
                15:57:06,843 INFO [EJBContainer] STARTED EJB: org.jboss.acme.consumer.Consumer ejbName: Consumer
                15:57:06,859 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
                

                Carlo, ALR, Jaikiran, I doubt this is expected? ;-)

                • 6. Re: Cant load class from one EAR to another
                  Andrew Rubinger Master

                  I'll have a look. First impression is that you've got a lifecycle start() on the MBean (one call) and @PostConstruct (2nd call) defined.

                  What I need to understand is why JBossASKernel is going through the install mechanism twice.

                  S,
                  ALR

                  • 8. Re: Cant load class from one EAR to another
                    Ales Justin Master

                     

                    "ALRubinger" wrote:
                    I'll have a look. First impression is that you've got a lifecycle start() on the MBean (one call) and @PostConstruct (2nd call) defined.

                    Yeah, that's sort of it.
                    If I remove the @PostConstruct, I only get single "Hello".
                    But if I rename the method, I don't get any.
                    Does this mean I need @Management?
                    (not that I really care, since the subject here is classloading, which works :-)

                    • 9. Re: Cant load class from one EAR to another
                      Andrew Rubinger Master

                      Ales can look at the ClassLoading, but I want to know about this double call to JBossASKernel. That's a big problem, especially since I just fixed a whole bunch of stuff in ServiceContainer/JBossASKernel to ensure that @Service start() is not re-entrant (resulting in double-callbacks).

                      ie. http://fisheye.jboss.org/changelog/JBossAS/?cs=82684, and the commits that followed it for EJBTHREE-655.

                      I've run Ales' example here on AS trunk r83097, and only get one call to JBossASKernel install (as expected). So I need a good failing example, unless its possible that something's out of whack with the build on whatever the log below was run.

                      S,
                      ALR