Hmm... My mbeans were custom server components. While your mbeans are probably registered, I don't think there is any automatic instantiation. Maybe I'm wrong: I'd like to be corrected by anyone else following this thread.
Otherwise, I've been looking over the code, and it seems like you'd have to use some indirection to do it: Create a Server LifeCycleListener that instantiated your mbean when the server started, for example. Benjamin J. Armintor Systems Analyst ITS-Systems: Mainframe Group University of Texas - Austin tele: (512) 232-6562 email: [EMAIL PROTECTED] -----Original Message----- From: Chad Boyd [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 9:54 AM To: Tomcat Users List Subject: RE: Custom MBeans in Tomcat 5 My MBean is not a Valve or Realm element, so there are no elements in the server.xml file. The only experience I've had with MBeans is on JBoss. With JBoss, all you had to do is drop the packaged MBean and descriptor into the deploy directory and JBoss registered and created an instance of it for you. Then all you had to do is look it up. I assumed Tomcat did something similar as far as creating and registering the MBean for you. Is this not a correct assumption? If you've had success deploying custom MBeans on Tomcat 5, could you send me an example of how I can do this? Thanks. -----Original Message----- From: Benjamin Armintor [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 8:44 AM To: Tomcat Users List Subject: RE: Custom MBeans in Tomcat 5 Ahh, this is kind of tricky. Your Mbean may very well be in the Registry, but if you're getting an InstanceNotFoundException, then your asking for an instance of it that's not there (Asking for an Mbean that wasn't registered would just get you a null, I believe). The Mbean is more like a registered "type". You still need to create the instances somehow. Where do you create an instance of the Mbean? If, as in the Realm and Valve examples mentioned in the Tomcat docs, your bean is a custom server component, then the Tomcat internals take care of that for you with the <Valve> or <Realm> elements in your server.xml. Benjamin J. Armintor Systems Analyst ITS-Systems: Mainframe Group University of Texas - Austin tele: (512) 232-6562 email: [EMAIL PROTECTED] -----Original Message----- From: Chad Boyd [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 5:27 PM To: Tomcat Users List Subject: RE: Custom MBeans in Tomcat 5 Thanks for your quick response, Benjamin. I tried including the mbeans-descriptors.xml file in the package com.ihs.config in my mbean jar but this still didn't work. I've included my mbeans-descriptors.xml file and the entry in the server.xml file. Could you take a look and see if anything looks out of place? If there's anything else you would like to see, please let me know. Thanks. mbeans-descriptors.xml file: <mbeans-descriptors> <mbean name="Merchant" className="com.ihs.config.AppConfigMBean" description="Configuration MBean" domain="com.ihs.config" group="Realm" type="javax.management.DynamicMBean"> <attribute name="configFileLoc" description="Location of the application configuration file." type="java.lang.String" writeable="false">d:\javaSites\properties\ihs-web\ihs-web.properties</at tribute> </mbean> </mbeans-descriptors> server.xml file: <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" descriptors="/com/ihs/config/mbeans-descriptors.xml"/> Object name used to try and look up the MBean: com.ihs.config:name=Merchant -----Original Message----- From: Benjamin Armintor [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 4:18 PM To: Tomcat Users List Subject: RE: Custom MBeans in Tomcat 5 Yes: The mbeans-descriptors.xml file needs to be jarred up in a package that corresponds to the path in your server.xml. The reference in the server.xml file is a getResource() parameter, not a file path per se. Benjamin J. Armintor Systems Analyst ITS-Systems: Mainframe Group University of Texas - Austin tele: (512) 232-6562 email: [EMAIL PROTECTED] -----Original Message----- From: Chad Boyd [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 4:14 PM To: [EMAIL PROTECTED] Subject: Custom MBeans in Tomcat 5 Has anyone had any luck deploying one of their own MBeans in Tomcat? I've got a Dynamic MBean I'm trying to deploy and I've had no luck. I've tried both methods listed at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/mbeans-descriptor-howto. html. Neither one seemed to work. I've got my mbean jar in the commons/lib directory, my mbeans-descriptors.xml file in the commons/classes directory, and changed server.xml to point to this file. How can I determine if this MBean has been deployed. I tried going to the jmxproxy page in the manager app but didn't see it loaded there. When I try to look it up in my code I get an InstanceNotFoundException. Could someone please help me? I can supply my entry in the mbeans-descriptors.xml file if needed. Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
