I am trying to get the reference of Tomcat MBeanServer I am using the folowing code :
------------------------------------------------------- RemoteMBeanServer server; IIOPConnector con = new IIOPConnector(); String protocol = "http"; String host = "192.168.0.15"; int port = 7080; String path = ""; JMXAddress address = new JMXAddress(protocol, host, port, path); Hashtable props = new Hashtable(); props.put(Context.INITIAL_CONTEXT_FACTORY, "javax.naming.InitialContext"); props.put(Context.SECURITY_PRINCIPAL, "admin"); props.put(Context.SECURITY_CREDENTIALS, ""); con.connect(address.getPath(), props); server = con.getRemoteMBeanServer(); ------------------------------------------------------- Classes RemoteMBeanServer and JMXAddress are from mx4j.connector package. I dont now what value we should give for Context.INITIAL_CONTEXT_FACTORY And also JMXAddress constructor takes a String parameter path. I dont know what exactly this means. Has any one tried this out. Is this the proper way for getting MBeanServer reference. If anybody has tried it please get me a sample code for this. Santosh --- Bill Barker <[EMAIL PROTECTED]> wrote: > You need to have the JkCoyote connector running > (even if you are using > Tomcat stand-alone), and in your > $CATALINA_HOME/conf/jk2.properties file > add: > mx.port=9000 > Of course, change '9000' to whatever port you want > the JMX consol to listen > to. > > Note: There is a bug in Tomcat that is doesn't > shutdown the consol properly > if you use this option. As a result, you will lose > the ability to do a > clean shutdown. > > "s p" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi Purvis, > > > > Thanks for the reply. > > This code will give me the MBeanServers on the > same > > JVM > > But in our case we want to get the MBeanServer of > a > > remote Tomcat. The Tomat server may be running on > any > > other machine. I would have the port number and > the > > address of the machine where the Tomcat is > running. So > > the problem is to get MBeanServer of this Tomcat. > > Do we have any APIs for doing this? > > > > Santosh > > > > --- Purvis Robert <[EMAIL PROTECTED]> > wrote: > > > I've done this just recently in fact! I was > looking > > > for a means of > > > monitoring objects within our Tomcat and > dicovered > > > JMX. To get to Tomcats > > > Mbean Server you use the following (I've got it > in a > > > GeneralJMX class in a > > > static method for easy of reuse): > > > > > > public class GeneralJMX { > > > > > > /** Creates a new instance of GeneralJMX */ > > > public GeneralJMX() { > > > } > > > > > > > > > > > > /*************************************************************************** > > > * > > > * Get the MBean server associated with > Tomcat. > > > * > > > * @return the MBean server, or null if one > canot > > > be found. > > > */ > > > > > > public static MBeanServer > getTomcatMBeanServer() > > > { > > > MBeanServer server = null; > > > List myList = > > > MBeanServerFactory.findMBeanServer(null); > > > if (myList.toArray().length > 0) > > > server = > (MBeanServer)myList.toArray()[0]; > > > > > > return server; > > > } > > > > > > } > > > > > > -----Original Message----- > > > From: s p [mailto:[EMAIL PROTECTED] > > > Sent: 27 August 2003 03:59 > > > To: [EMAIL PROTECTED] > > > Subject: How to get reference of MBeanServer in > > > Tomcat > > > > > > > > > I am using JMX technology to get information of > > > Tomcat > > > server. I am unable to get the reference of the > > > MBeanServer in Tomcat. Has any one worked on > this > > > before. I am able get the information for other > > > application servers like weblogic and webshere. > But > > > I > > > did not find suitable APIs for Tomcat. Any help > in > > > this direction will be appreciated. > > > > > > Regards, > > > Santosh > > > > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! SiteBuilder - Free, easy-to-use web site > > > design software > > > http://sitebuilder.yahoo.com > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > This e-mail is confidential and privileged. If > you > > > are not the intended > > > recipient please accept our apologies; please > do > > > not disclose, copy or > > > distribute information in this e-mail or take > any > > > action in reliance on its > > > contents: to do so is strictly prohibited and > may > > > be unlawful. Please > > > inform us that this message has gone astray > before > > > deleting it. Thank you > > > for your co-operation. > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free, easy-to-use web site > design software > > http://sitebuilder.yahoo.com > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
