5 Replies Latest reply on Jun 30, 2003 2:55 AM by Oded Hassidi

    Custon MBean

    twutort Newbie

      When I create a custom MBean I get the following error when attempting to start my server:

      java.lang.ClassNotFoundException: No ClassLoaders found for com.smg.common.util.StartupProperty

      My code deployed fine. I defined the mbean in jboss-service.xml. Is there somewhere else I need to define this bean?

        • 1. Re: Custon MBean
          twutort Newbie

          I figured this out but now I get an error when I try to add a custom attribute:

          No Attribute found with name: test

          Any ideas?

          • 2. Re: Custon MBean
            Oded Hassidi Newbie

            I have the same problem, how did u figured it out?

            • 3. Re: Custon MBean
              Jon Barnett Master

              You should probably not use the JBoss configuration file for your custom MBeans, at least not in development. If you have a 3.x.x release, look at server/default/deploy/user-service.xml. It shows how to configure your custom MBean. Just name your MBean service configuration file *-service.xml and drop it in your deploy directory, and your MBean will register itself. This doesn't solve your problem but will make your life easier during development - we leave our MBeans configuration files in the deploy directory.

              Now to your specific problem. Have you defined the attribute in your interface and the setter and getter in your implementation?

              For example,

              requires that your interface has this:

              public interface ObjectPoolLoaderMBean extends ServiceMBean
              public void setPoolName(String name);
              public String getPoolName();

              and your MBean implementation contains this:

              public class ObjectPoolLoader extends ServiceMBeanSupport implements ObjectPoolLoaderMBean, ObjectFactory
              private String poolName;
              public void setPoolName(String poolName)
              this.poolName = poolName.trim();

              public String getPoolName()
              return poolName;

              This is case sensitive. So your MBean would need settest defined in the interface and implemented. This is most likely your issue. I believe TheServerSide has a good MBean tutorial.

              Hope that helps.

              • 4. Re: Custon MBean
                Jon Barnett Master

                I forgot, my bad - for you to dynamically deploy this, your classes must be in a SAR so you must use a META-INF/jboss-service.xml. However, it does make things easier during development rather than stopping and starting JBoss all the time - which does get tedious.

                • 5. Re: Custon MBean
                  Oded Hassidi Newbie

                  I built all in one sar file.
                  The attribute is defined in the implementation and has getter and setter, and has getter and setter in the interface.

                  Why do I get the no attribute error