Hi Peter,
Thanks for sending the link. I guess what my real question was:
how would I get TC to 'declaratively' instantiate my MBeans ?
From the example, most of them has a main() method to instantiate and
register the MBeans to the platform MBean Server. What would you recommend
for TC , a servlet that loads on startup and within the init method it would
create and register the MBeans?
I am porting my MBeans from JBoss (embedding TC) and JBoss provides a
declarative method do so without the needs of a servlet. It is done by
creating a service archive (e.g. myservice.sar - containing a
jboss-service.xml [similar to mbeans-descriptor.xml] that declares the MBeans).
The JBoss container would then instantiate the MBeans via the MBean's start()
method.
public class Main {
public static void main(String[] args) throws Exception {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName(com.example.mbeans:type=Hello);
Hello mbean = new Hello();
mbs.registerMBean(mbean, name);
System.out.println(Waiting forever...);
Thread.sleep(Long.MAX_VALUE);
}
}
Thanks
Frank.
- Original Message
From: Peter Rossbach [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, January 9, 2008 1:20:10 AM
Subject: Re: looking for sample MBean code for tomcat 6
Please read this:
http://java.sun.com/developer/technicalArticles/J2SE/jmx.html
http://java.sun.com/j2se/1.5.0/docs/guide/jmx/tutorial/tutorialTOC.html
Peter
Am 09.01.2008 um 08:03 schrieb Frank Z:
hello,
I am looking some sample MBean code for TC 6.0.. I was able to
model some code after the source code (e.g.
MemoryUserDatabaseMBean.java in the org.apache.catalina.users.
package) .
I was also able to create the mbeans-descriptor.xml
One question that I have is that even though the code compiled and
deployed TC, i am not able to see my custom MBean via JConsole .
Are there additional things needed to get the MBean registered
properly in TC?
Thanks in advance.
__
__
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/
newsearch/category.php?category=shopping
-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]