13 Replies Latest reply on Sep 28, 2002 5:32 PM by Adrian Brock

    mbeans in sar?

    garyg Novice

      I'm trying to figure out the following errors and wondering if an mbean must be placed in a sar, cause right now it's in an ear along w/ my ejb's.

      --- error output ...

      01:44:34,931 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@23d7cabd{ url=file:/u/public/jboss/jboss-3.0.2/server/default/deploy/acaiis-scheduler-service.xml, deployedLastModified=0 }
      org.jboss.deployment.DeploymentException: DefaultDomain:service=Scheduler is not registered.; - nested throwable: (javax.management.InstanceNotFoundException: DefaultDomain:service=Scheduler is not registered.)
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:227)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:755)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)

        • 1. Re: mbeans in sar?
          garyg Novice

          Are *.sar files completely a jboss thing? I havn't heard of them before.

          Also, what goes in one and then where does it go? I've got a j2ee app and my mbeans are currently packaged in my ejb-jar (though not working) so I need to try something else with them.

          I was wondering how to put them in a sar and do whatever it's supposed to do.

          Any help much appreciated.

          • 2. Re: mbeans in sar?
            Adrian Brock Master

            A sar is a jboss specific package format

            It has the general format
            mypackage.sar/
            {other items, e.g. classes, other packages including sars}
            META-INF/
            META-INF/jboss-service.xml

            Look at jboss-net.sar for an example.

            You do not have to use a sar.
            You can create a
            -serivce.xml and put it in "deploy"
            with the classes elsewhere.

            Regards,
            Adrian

            • 3. Re: mbeans in sar?
              Phill Newbie

              I'm using an XXX-service.xml file and getting the same "user:service=XXXXX" not bound error. Any ideas as to what I might be missing? Aside deploying the class in my .jar, I have the following in my XXX-service.xml:

              <?xml version="1.0" encoding="UTF-8"?>






              any ideas?

              • 4. Re: mbeans in sar?
                Adrian Brock Master

                Have you tried registering the MBean with an
                MBeanServer to make sure it is a valid MBean?

                try
                {
                MBeanServer server = MBeanServerFactory().createMBeanServer();
                ObjectName name = new ObjectName("test:test=test");
                server.registerMBean(new myclassname(), name);
                }
                catch (Exception e)
                {
                e.printStackTrace();
                }

                Regards,
                Adrian

                • 5. Re: mbeans in sar?
                  Phill Newbie

                  I have now ;)
                  Seems to work fine...

                  I definitely seem to have the exact same thing that Tzuri is experiencing, and talks about in this thread, and that other one about "MBean not registered" or something.

                  The case is pretty simple, I have a basic class in my jar, and am using a Standard MBean pattern (it inherits from an interface named XXXMBean. Then I'm deploying the XXX-service.xml file I described in my earlier post.

                  Seems like maybe there's another step. I'm not sure how it's supposed to get registered if not through the deployment of the service.xml file. Is there another config file or something I need to configure?

                  -phill

                  • 6. Re: mbeans in sar?
                    garyg Novice

                    I really don't understand something here.

                    The docs say that if you are not dependent upon jboss classes (which I'm not), then all I need to do is implement the MBean service interface from ServiceMBean and the implementation class from ServiceMBeanSupport, and then I override only the service methods I need to use.

                    I don't see anything about having to register this MBean when writing a jboss mbean service. Isn't that what the MBean service descriptor does?

                    When posting to the mailing list, this seems to be the agreement there also.

                    • 7. Re: mbeans in sar?
                      Adrian Brock Master

                      I only suggested the manual registration to test
                      it is a valid MBean, not for the real deployment.

                      Without anymore information I can only guess why
                      you get a "Not Registered".

                      Can you show the *-service.xml.
                      "jar -tf" of the sar if you use a sar.
                      The location of the MBean class, i.e. which jar
                      and which directory.
                      The section(s) of the server.log that deal with the
                      deployment of the MBean and its class jar.

                      Somewhere in there must be the reason for the MBean
                      not getting registered.

                      Regards,
                      Adrian

                      • 8. Re: mbeans in sar?
                        garyg Novice

                        &#65279;The location of my service mbeans are in my *-ejb.jar file which is in my *.ear. For some reason the class isn't being found. I've included the errors from the server.log, the jboss output, the service file and the mbeans. So from the top level of my *-ejb.jar file it's path is com/neuroquest/cais/jmx/mbeans/scheduler. Don't know why it's not being found.

                        Any help much appreciated.

                        ---

                        2002-09-25 20:42:48,600 DEBUG [org.jboss.system.ServiceCreator] About to create
                        bean: DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,600 DEBUG [org.jboss.system.ServiceCreator] code: com.neuroq
                        uest.cais.jmx.mbeans.scheduler.Scheduler
                        2002-09-25 20:42:48,630 DEBUG [org.jboss.system.ServiceCreator] Class not found
                        for mbean: DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,634 DEBUG [org.jboss.deployment.SARDeployer] destroying mbea
                        n DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,635 DEBUG [org.jboss.system.ServiceController] destroying se
                        rvice: DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,662 DEBUG [org.jboss.deployment.SARDeployer] removing mbean
                        DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,663 DEBUG [org.jboss.system.ServiceController] removing serv
                        ice: DefaultDomain:service=Scheduler
                        2002-09-25 20:42:48,684 DEBUG [org.jboss.system.ServiceController] no need to re
                        move DefaultDomain:service=Scheduler from server
                        2002-09-25 20:42:48,698 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.Ne
                        stedThrowable.parentTraceEnabled=true
                        2002-09-25 20:42:48,750 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.Ne
                        stedThrowable.nestedTraceEnabled=true
                        2002-09-25 20:42:48,751 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.Ne
                        stedThrowable.detectDuplicateNesting=true
                        2002-09-25 20:42:48,761 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner
                        ] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedUR
                        L@23d7cabd{ url=file:/u/public/jboss/jboss-3.0.2/server/default/deploy/acaiis-sc
                        heduler-service.xml, deployedLastModified=0 }
                        org.jboss.deployment.DeploymentException: DefaultDomain:service=Scheduler is not
                        registered.; - nested throwable: (javax.management.InstanceNotFoundException: D
                        efaultDomain:service=Scheduler is not registered.)
                        at org.jboss.deployment.SARDeployer.create(SARDeployer.java:227)


                        --- my service file ... ~/server/default/deploy/acaiis-schedular-service.xml

                        <?xml version="1.0" encoding="UTF-8"?>






                        --- implementation

                        public class Scheduler extends org.jboss.system.ServiceMBeanSupport
                        implements SchedulerMBean
                        {
                        private String name;
                        private org.quartz.Scheduler sched;

                        private static com.neuroquest.cais.log.Logger
                        log = new com.neuroquest.cais.log.Logger();

                        public void createService() throws Exception {

                        System.out.println("Creating MBean ...........");
                        log.info(Scheduler.class, "Creating MBean ...........");

                        SchedulerFactory schedFact = (SchedulerFactory) new StdSchedulerFactory();
                        sched = (org.quartz.Scheduler) schedFact.getScheduler();


                        return;
                        }

                        public String getName() {
                        return "Scheduler name = " + name;
                        }

                        public void startService() throws Exception {
                        sched.start();

                        log.info(Scheduler.class, "Starting Scheduler Service MBean ...........");
                        }

                        public void stopService() {
                        try {
                        sched.shutdown();
                        }
                        catch (Exception e) {
                        log.error(Scheduler.class, e.getMessage());
                        }

                        log.info(Scheduler.class, "Stopping Scheduler Service MBean ...........");
                        }
                        }

                        --- interface class

                        public interface SchedulerMBean extends org.jboss.system.ServiceMBean
                        {
                        public void createService() throws Exception;
                        public void start() throws Exception;
                        public void stop();
                        }

                        --- server log file

                        20:42:48,511 INFO [MainDeployer] Starting deployment of package: file:/u/public/jboss/jboss-3.0.2/server/default/deploy/acaiis-scheduler-service.xml
                        20:42:48,761 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@23d7cabd{ url=file:/u/public/jboss/jboss-3.0.2/server/default/deploy/acaiis-scheduler-service.xml, deployedLastModified=0 }
                        org.jboss.deployment.DeploymentException: DefaultDomain:service=Scheduler is not registered.; - nested throwable: (javax.management.InstanceNotFoundException: DefaultDomain:service=Scheduler is not registered.)
                        at org.jboss.deployment.SARDeployer.create(SARDeployer.java:227)
                        at org.jboss.deployment.MainDeployer.create(MainDeployer.java:755)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)

                        • 9. Re: mbeans in sar?
                          Adrian Brock Master

                          Ok,

                          I think I understand now.

                          The *-service.xml are processed before the ejbs/ears

                          You need to specify the class dependency in your
                          -service.xml



                          This should work? I've never tried it with a class inside
                          a jar inside another jar.

                          BUT, I think you might promote your ear deployment
                          to before the other *-service.xml and sars.
                          So then you might get problems with the database not
                          deployed yet?

                          It is probably best to make your service a .sar
                          inside the ear.
                          Add a jboss-app.xml next to the application.xml

                          <jboss-app>

                          yourservice.sar

                          </jboss-app>

                          Regards,
                          Adrian

                          • 10. Re: mbeans in sar?
                            garyg Novice

                            I seem to be getting closer and I hope all this is looking right. Now the only errors I get are as follows ...
                            --- jboss output ---

                            03:44:43,596 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompleteDeployments()'
                            Cause: Incomplete Deployment listing:
                            Packages waiting for a deployer:
                            [org.jboss.deployment.DeploymentInfo@79dd0aa0 { url=file:/u/public/jboss/jboss-3.0.2/server/default/deploy/jboss-app.xml }
                            deployer: null
                            status: null
                            state: INIT_WAITING_DEPLOYER
                            watch: file:/u/public/jboss/jboss-3.0.2/server/default/deploy/jboss-app.xml
                            lastDeployed: 1033112683555
                            lastModified: 1033112683000
                            mbeans:
                            ]Incompletely deployed packages:
                            [org.jboss.deployment.DeploymentInfo@79dd0aa0 { url=file:/u/public/jboss/jboss-3.0.2/server/default/deploy/jboss-app.xml }
                            deployer: null
                            status: null
                            state: INIT_WAITING_DEPLOYER
                            watch: file:/u/public/jboss/jboss-3.0.2/server/default/deploy/jboss-app.xml
                            lastDeployed: 1033112683555
                            lastModified: 1033112683000
                            mbeans:
                            ]MBeans waiting for classes:

                            MBeans waiting for other MBeans:


                            03:44:43,639 INFO [URLDeploymentScanner] Started
                            03:44:43,642 INFO [MainDeployer] Deployed package: file:/u/public/jboss/jboss-3.0.2/server/default/conf/jboss-service.xml
                            03:44:43,715 INFO [Server] JBoss (MX MicroKernel) [3.0.2 Date:200208271339] Started in 1m:41s:160ms



                            FYI - here's what my *.ear now looks like ...

                            $ jar tvf acaiis_mgr-0.30b.ear
                            0 Fri Sep 27 03:21:34 EDT 2002 META-INF/
                            43 Fri Sep 27 03:21:34 EDT 2002 META-INF/MANIFEST.MF
                            2325 Fri Sep 27 03:21:10 EDT 2002 META-INF/jboss.xml
                            250 Fri Sep 27 03:21:28 EDT 2002 META-INF/jboss-service.xml
                            410 Fri Sep 27 03:21:34 EDT 2002 META-INF/application.xml
                            75986 Fri Sep 27 03:21:10 EDT 2002 acaiis-ejb.jar
                            1630561 Fri Sep 27 03:21:28 EDT 2002 acaiis-web.war
                            2985 Fri Sep 27 03:21:28 EDT 2002 acaiis-service.sar

                            And of course the ejb-jar.xml is in the ~/META-INF/ of the *-ejb.jar which gets put in the same META-INF at the top level.

                            My *.sar now looks like ...
                            $ jar tvf acaiis-service.sar
                            0 Fri Sep 27 03:42:42 EDT 2002 META-INF/
                            43 Fri Sep 27 03:42:42 EDT 2002 META-INF/MANIFEST.MF
                            0 Fri Sep 27 03:42:16 EDT 2002 com/
                            0 Fri Sep 27 03:42:16 EDT 2002 com/neuroquest/
                            0 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/
                            0 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/jmx/
                            0 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/jmx/mbeans/
                            0 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/
                            250 Fri Sep 27 03:42:42 EDT 2002 META-INF/jboss-service.xml
                            2136 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/Scheduler.class
                            270 Fri Sep 27 03:42:22 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/SchedulerMBean.class

                            MyApps-service.xml is now the ~/META-INF/jboss-service.xml which looks like ...
                            ---
                            <?xml version="1.0" encoding="UTF-8"?>










                            And I added a jboss-app.xml file which looks like ...
                            ---
                            <?xml version="1.0" ?>


                            <display-name>A.C.A.I.I.S.</display-name>


                            acaiis-service.sar



                            • 11. Re: mbeans in sar?
                              Adrian Brock Master

                              The ear should have
                              META-INF/application.xml and the META-INF/jboss-app.xml

                              The sar should have
                              META-INF/jboss-service.xml

                              Regards,
                              Adrian

                              • 12. Re: mbeans in sar?
                                garyg Novice

                                Adrian,

                                Thanks for all your help. My service seems to be created and started fine from the println()'s in the overridden methods of the mbeans.

                                If I may, I have a few more questions which don't seem to be affecting my application.

                                When deploying my *.ear file, I'm getting the following error, yet it is being deployed and working fine.
                                ---

                                20:28:03,047 ERROR [SARDeployer] operation failed
                                org.jboss.deployment.DeploymentException: url file:/u/public/jboss/jboss-3.0.2/server/default/tmp/deploy/server/default/deploy/acaiis_mgr-0.30b.ear/62.acaiis_mgr-0.30b.ear-contents/acaiis_mgr-0.30b.ear could not be opened, does it exist?

                                ---
                                And although the quartz.jar is in my ~/server/default/deploy dir, I get the following. Note: this jar holds classes as used by my scheduler mbean.
                                ---

                                20:28:03,167 ERROR [SARDeployer] operation failed
                                org.jboss.deployment.DeploymentException: url file:/u/public/jboss/jboss-3.0.2/server/default/tmp/deploy/server/default/deploy/acaiis_mgr-0.30b.ear/62.acaiis_mgr-0.30b.ear-contents/quartz.jar could not be opened, does it exist?

                                And before both of these messages, I get the following showing that the quartz.jar seems to have been found ok and deployed.
                                ---
                                20:27:56,400 INFO [MainDeployer] Deployed package: file:/u/public/jboss/jboss-3.0.2/server/default/deploy/quartz.jar

                                Here's my packaging
                                ---
                                $jar tvf acaiis_mgr-0.30b.ear
                                0 Fri Sep 27 20:22:52 EDT 2002 META-INF/
                                43 Fri Sep 27 20:22:52 EDT 2002 META-INF/MANIFEST.MF
                                2325 Fri Sep 27 20:22:24 EDT 2002 META-INF/jboss.xml
                                113 Fri Sep 27 20:22:24 EDT 2002 META-INF/jboss-app.xml
                                410 Fri Sep 27 20:22:52 EDT 2002 META-INF/application.xml
                                76208 Fri Sep 27 20:22:26 EDT 2002 acaiis-ejb.jar
                                1630589 Fri Sep 27 20:22:46 EDT 2002 acaiis-web.war

                                ---
                                $ jar tvf acaiis-service.sar
                                0 Fri Sep 27 20:22:46 EDT 2002 META-INF/
                                43 Fri Sep 27 20:22:46 EDT 2002 META-INF/MANIFEST.MF
                                0 Fri Sep 27 20:22:18 EDT 2002 com/
                                0 Fri Sep 27 20:22:18 EDT 2002 com/neuroquest/
                                0 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/
                                0 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/jmx/
                                0 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/jmx/mbeans/
                                0 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/
                                250 Fri Sep 27 20:22:46 EDT 2002 META-INF/jboss-service.xml
                                2136 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/Scheduler.class
                                270 Fri Sep 27 20:22:24 EDT 2002 com/neuroquest/cais/jmx/mbeans/scheduler/SchedulerMBean.class

                                The *.ear, *.sar, and quartz.jar are in ~/server/default/deploy.

                                Thanks again!

                                • 13. Re: mbeans in sar?
                                  Adrian Brock Master

                                  I'm guessing you have some MANIFEST.MF Class-Path or
                                  application.xml references
                                  to jars outside the deployment package?

                                  Regards,
                                  Adrian