4 Replies Latest reply on May 23, 2002 8:57 AM by qwang

    How to make a custom MBean to be loaded when JBoss finishes

    qwang

      I have standard MBean that using one of the JBoss' classes, say RMIAdaptor. When I started the JBoss server after copied my MBean's SAR file to defautl/deploy directory, I got ClassNotFoundException because JBoss cannot find RMIAdaptor class when deploying my MBean. I have tried to use "" tag, but I couldn't find a appropriate MBean or EJB on which my MBean can depend when JBoss starts up.

      Could anyone tell me which MBean I should set dependency with to allow my MBean to be deployed only after JBoss has start up completely?

      Thanks.

      qwang

        • 1. Re: How to make a custom MBean to be loaded when JBoss finis
          davidjencks

          I think you want to use the classpath element with a reference to the classes location to make sure it is available before the mbean is created.

          Also, for recent versions of jboss 3 (rc2 and 3.1), the deployment of your mbean should just wait until the class is available, without the classpath element or you doing anything else.

          Which jboss version are you using? If you deploy your mbean/sar after jboss has completely started does it deploy without error?

          • 2. Re: How to make a custom MBean to be loaded when JBoss finis
            qwang

            I am using 3.0.0RC2 and there is no problems if it is deployed after JBoss has completely started up. But, I cannot deploy it by copying to deploy directory and then starting up JBoss. This gives me ClassDefNoFoundException because the RMIAdaptor class is not loaded up yet. What I want to know is what kind of dependency I can set up in the jboss-service.xml in my SAR file to delay the deployment of my MBean till the server has completely started up.

            Thank you.

            qwang

            • 3. Re: How to make a custom MBean to be loaded when JBoss finis

              Hot deployment means the server has never completely
              started up. Things can be added at any time.

              You can place a dependency on another MBean and your
              service will start after it.

              You do this by adding the tag (example)

              jboss.jmx:type=adaptor,protocol=RMI
              to your *-service.xml

              The closest you will get to after the initial start is
              to place a dependency on the Deployment Scanner.
              It does an initial scan and deploy of "static" deployments
              during startup.

              Regards,
              Adrian

              • 4. Re: How to make a custom MBean to be loaded when JBoss finis
                qwang

                Thank you. I've got it work.

                qwang