Ok, since I'm subclassing from ServiceMBeanSupport ... I'm still getting the
same errors (the not Registered exception below). I took out the override to
preRegister().

Also, I didn't get why I need to use an xml dd and can't to it by hand since
it's a little late in the game for me to start adding xdoclet everywheres.
My project is like 90% complete and maybe once I get an initial release out
I can do that, but not now.

----- Original Message -----
From: "David Jencks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 15, 2002 3:58 PM
Subject: Re: [JBoss-user] pre-registering an mbean


> You are working way way way too hard.  If you subclass ServiceMBeanSupport
> you normally don't need to implement preRegister, and for sure it is not a
> managed operation.  If you want to supply mbean descriptor stuff use a
> dynamic mbean or an xmbean. In any case generate the interface or xmbean
> xml dd using xdoclet.
>
> If you need initialization logic put it in createService or startService.
>
> Look at a simple example in jboss such as XidFactory (goes with tx
> manager).
>
> david jencks
>
> On 2002.09.15 16:30:57 -0400 G.L. Grobe wrote:
> > Anyone have any info on how to pre-register an mbean? I'm going through
> > the
> > docs (and maybe I'm missing it) but I just don't see anything about how
> > to
> > do this. I just copied the pre-register method from the on-line docs,
but
> > didn't see any mention of it. Below is the error I'm getting, and below
> > that
> > is the mbean ...
> >
> > Any help much appreciated.
> >
> > 16:45:58,911 INFO  [MainDeployer] Starting deployment of package:
> >
file:/u/public/jboss/jboss-3.0.2/server/default/deploy/acaiis-scheduler-serv
> > ice.xml
> > 16:45:59,773 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(ReflectedMBeanDispat
> > cher.java:284)
> >         at
> > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
> >         at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
> >         at $Proxy4.deploy(Unknown Source)
> >         at
> >
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanne
> > r.java:427)
> > ...
> >
> >
> > --- *-service.xml deployment descriptors
> >
> >    <mbean code="com.neuroquest.cais.jmx.mbeans.scheduler.Scheduler"
> > name="DefaultDomain:service=Scheduler">
> >    </mbean>
> >
> >
> > --- I'm trying to implement a scheduling service, so this is just the
> > framework.
> > --- Scheduler.java mbean
> >
> > public class Scheduler extends org.jboss.util.ServiceMBeanSupport
> >       implements SchedulerMBean
> > {
> >    private String name;
> >
> >    public ObjectName preRegister( MBeanServer server, ObjectName name)
> >          throws Exception {
> >       log.info( Scheduler.class, "preregister notification seen");
> >
> >       Class thisClass = getClass();
> >       Class[] parameterTypes  = { String.class };
> >
> >       Method echoMethod = thisClass.getMethod( "echo", parameterTypes);
> >
> >       String desc = "The echo op invokes the session bean echo method
and
> > "
> >          + "returns it's value prefixed with the helloPrefix attribute
> > value";
> >
> >       operations[0] = new MBeanOperationInfo( desc, echoMethod);
> >
> >       parameterTypes = new Class[0];
> >
> >       Method createMethod = thisClass.getMethod("create",
> > parameterTypes);
> >       operations[1] = new
> >          MBeanOperationInfo( "The JBoss Service.create", createMethod);
> >
> >       Method startMethod = thisClass.getMethod("start", parameterTypes);
> >       operations[2] = new
> >          MBeanOperationInfo( "The JBoss Service.start", startMethod);
> >
> >       Method stopMethod = thisClass.getMethod("stop", parameterTypes);
> >       operations[3] = new
> >          MBeanOperationInfo( "The JBoss Service.stop", stopMethod);
> >
> >       Method destroyMethod = thisClass.getMethod("destroy",
> > parameterTypes);
> >       operations[4] = new
> >          MBeanOperationInfo( "The JBoss Service.stop", destroyMethod);
> >
> >       return name;
> >    }
> >    public boolean createScheduler() {
> >
> >       System.out.println("Creating MBean ...........");
> >       log.info(Scheduler.class, "Creating MBean ...........");
> >
> >       SchedulerFactory schedFact = new StdSchedulerFactory();
> >       Scheduler sched = schedFact.getScheduler();
> >
> >       sched.start();
> >
> >       return true;
> >    }
> >
> >    public String getName() {
> >       return "Scheduler name = " + name;
> >    }
> >
> >    public void startService()() throws Exception {
> >       log.info(Scheduler.class, "Starting Scheduler Service MBean
> > ...........");
> >       System.out.println("starting MBean ...........");
> >    }
> >
> >    public void stopService() throws Exception {
> >       log.info(Scheduler.class, "Stopping Scheduler Service MBean
> > ...........");
> >       System.out.println("stoping MBean ...........");
> >    }
> > }
> >
> > --- SchedulerMBean.java
> >
> > public interface SchedulerMBean extends org.jboss.util.ServiceMBean
> > {
> >    public void start() throws Exception;
> >    public void stop() throws Exception;
> >    public boolean createScheduler() throws Exception;
> >    public ObjectName preRegister( MBeanServer server, ObjectName name)
> >       throws Exception;
> > }
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> >
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>



-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to