5 Replies Latest reply on Sep 8, 2003 6:42 PM by Craig Johannsen

    Instantiating Service Classes

    Srivatsan Newbie

      Hi,

      I have two service archives, First.sar & Second.sar.
      A Service present in the Second.sar is dependent over a Service present in First.sar and the second service uses a class present in the First.sar, and I have mentioned the dependency in the jboss-service.xml in the Second.sar.

      Now when the Second.sar is deployed before the First.sar, NoClassDefFoundError occurs because the First.sar is not yet deployed.

      I think JBoss instantiates the Service class and then verifies for the existence of dependent services.
      Why is it so?

      Thanks,
      Srivatsan

        • 1. Re: Instantiating Service Classes
          Adrian Brock Master

          This is supported in jboss4, it hasn't been
          backported to jboss3

          Regards,
          Adrian

          • 2. Re: Instantiating Service Classes
            Alwyn Schoeman Newbie

            So does that mean that putting other service in will not work in 3.x?

            I have the additional problem where my mbean cannot find a utility class that is in server/default/lib even though I put in the deployment descriptor.

            What am I doing wrong?

            • 3. Re: Instantiating Service Classes
              Adrian Brock Master

              You shouldn't need to do the last part,
              conf/jboss-service.xml already loads those jars.
              I don't know what you are doing wrong without
              more information.

              For the if you are trying to specify
              a dependency on a class it won't work in 3.x,
              you can use the statement to load
              the sar, but it is probably better to include both
              services in the same sar.

              Regards,
              Adrian

              • 4. Re: Instantiating Service Classes
                Alwyn Schoeman Newbie

                Hi,

                I have found the problem with the class not being found. The class that it complained about was in the lib directory, but another class on which it depended wasn't. The other message didn't mention the missing class so it was a bit confusing...

                I'm specifying a dependency on another mbean e.g. my.domain:service=MyService. It seems to work as they have always loaded in the correct order, so far at least...

                Regards,
                Alwyn

                • 5. Re: Instantiating Service Classes
                  Craig Johannsen Newbie

                  Similar to Alwyn's problem, I found that a missing class was reported although that particular class was actually present. Adding another jar file to the lib directory fixed the problem.

                  So, I suspect, at least in some cases, there is a bug in reporting which class is not being found.

                  To anyone experiencing the NoClassDefFoundError, try adding jar files on which that class depends. The error message may go away.