3 Replies Latest reply on Feb 19, 2003 12:21 PM by Juha Lindfors

    Loading MBeans in CustomClassloader

    Jagannath Newbie

      Hi,

      When I register an MBean which is a classloader,in JBoss3.0.0 ,I see that the URLs from this MBean are stored in the UniformLoaderRepository. Now when I am doing DefaultLoaderRepository.loadClass() I am able to get the class from the URL.
      But it JBoss3.0.4 this is changed. Here neither the URLs get stored in the UniformLoaderRepository3 nor the different classloaders are looked up while loading the class through loadClass in DefaultLoaderRepository.

      Since I have developed my application based on JBoss3.0.0 version I would like to know do I get the class that is loaded in my customclass loader. Are there any workaround for this?

      Looking forward to the reply.

      Thanks,
      Jagannath

        • 1. Re: Loading MBeans in CustomClassloader
          Juha Lindfors Master

          3.0.4 no longer automatically adds classloaders to the repository when they're registered to the server. Try using the MBeanRepository addClassloader() methods directly and see if that helps. The repository is bound under JMImplementation:service=LoaderRepository,name=Default as an MBean and exposes the operations as MBean operations. Check the jmx-console.

          • 2. Re: Loading MBeans in CustomClassloader
            Jagannath Newbie

            Dear Juha,

            Thanks for the workaround. I used the newClassLoader operation to add the URLs to the repository since the addClassLoader method is not exposed as an operation. Noe I am able to load my MBeans through the DefaultLoaderRepository.

            But then I have two questions

            1. Is this(not adding the classloader mbeans to the repository) an intended behavior? I am asking this because the javadocs for DefaultLoaderRepository says that it maintains the classloaders registered in the MBeanServer.

            2. How do I make my applications portable for JBoss3.0.0 and JBoss3.0.4 and also sholu make it independent of App Servers? Since for one I need to register the ClassLoader MBean and for the other invoke the newClassLoader operation. Moreover the newClassLoader operation is specific to JBoss.

            Eagerly waiting for the reply.

            Regards,
            Jagannath

            • 3. Re: Loading MBeans in CustomClassloader
              Juha Lindfors Master

              > 1. Is this(not adding the classloader mbeans to the
              > repository) an intended behavior? I am asking this
              > because the javadocs for DefaultLoaderRepository says
              > that it maintains the classloaders registered in the
              > MBeanServer.

              In terms of JMX specification this is non-compliant behavior that JBoss server uses.


              > 2. How do I make my applications portable for
              > JBoss3.0.0 and JBoss3.0.4 and also sholu make it
              > independent of App Servers? Since for one I need to
              > register the ClassLoader MBean and for the other
              > invoke the newClassLoader operation. Moreover the
              > newClassLoader operation is specific to JBoss.

              See above. This behavior in 3.0.x series is not compliant and therefore also not portable.

              JMX 1.2 specification defines a PrivateClassLoader tagging interface and PrivateMLet that allows you to control this behavior -- whether a classloader should be registered with the classloader repository or not. Before 1.2 version of the spec this behavior was implicitly assumed but not strictly defined in the specification.

              HTH,

              -- Juha