Hello Ben,

   You are right, Tomcat, with these standard JVM JMX parameters,
creates a new MBeanServer that is not the platform mbean server and
that does not contain the JVM Mbeans (1). I didn't take the time to
figure out wether it was the JVM or Tomcat behavior.

   On production, we use Hyperic declaring two servers : a "JVM
server" and a "Apache Tomcat 6.0 Server". I must admit it is not the
most elegant but it does the job :-)

   For my JMX troubleshooting on Tomcat, I use JVisualVM (with the
MBeans plugin) and a few JSP pages I drop in my web apps :
http://cyrille-leclerc.googlecode.com/svn/trunk/cyrille/src/main/webapp/tools/jmx/mbeans.jsp
http://cyrille-leclerc.googlecode.com/svn/trunk/cyrille/src/main/webapp/tools/jmx/mbean.jsp
http://cyrille-leclerc.googlecode.com/svn/trunk/cyrille/src/main/webapp/tools/jmx/platformMbeans.jsp
   I mostly use the two firsts jsps as I mostly monitor Tomcat and
application specific MBeans, not very much JVM MBeans (except via
Hyperic).

   Hope this helps,

   Cyrille
--
Cyrille Le Clerc
clecl...@xebia.fr
http://blog.xebia.fr

(1) : java.lang:type=Runtime, java.lang:type=OperatingSystem,
java.lang:type=Threading, java.lang:type=Memory

On Tue, Dec 8, 2009 at 4:07 PM, Ben Katz <ben.k...@gmail.com> wrote:
> Hi Cyrille,
>
> Thanks for you reply.
> I have actually done what you suggested but that does not relate to the
> problem.
>
> To better Illustrate I will give this example:
>
> If I run the code below from a servlet in Tomcat I will get a list of
> domains:
>        String[] domains =
> ManagementFactory.getPlatformMBeanServer().getDomains();
>
>        for (int i =0; i < domains.length;i++)
>        {
>            System.out.println(domains[i]);
>        }
>
> If I run the same code from a generic java application I will get a
> different list of domains.
>
> This means that the platform MBean server is different inside Tomcat.
> What I would like to do is to reach that server, probably by replacing
> "ManagementFactory.getPlatformMBeanServer().getDomains();" with something
> else.
>
> Thanks again,
> Ben.
>
>
> On Tue, Dec 8, 2009 at 15:00, Cyrille Le Clerc <clecl...@xebia.fr> wrote:
>
>>   Hello Ben,
>>
>>   Tomcat relies on the out-of-the-box feature of the JVM to make the
>> MBeanServer accessible to other processes (possibly located on other
>> servers).
>>
>>   You have to add the following parameters to the Tomcat startup
>> command line :
>>    -Dcom.sun.management.jmxremote \
>>    -Dcom.sun.management.jmxremote.port=6969 \
>>    -Dcom.sun.management.jmxremote.ssl=false \
>>    -Dcom.sun.management.jmxremote.authenticate=false
>>
>> JMX listen port 6969 is configurable.
>>
>> All details at http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html
>>
>> Hope this helps,
>>
>> Cyrille
>>
>> --
>> Cyrille Le Clerc
>> clecl...@xebia.fr
>> http://blog.xebia.fr
>>
>> On Tue, Dec 8, 2009 at 1:34 PM, Ben Katz <ben.k...@gmail.com> wrote:
>> >
>> > Hi,
>> > I use ManagementFactory.getPlatformMBeanServer() from within Apache
>> Tomcat
>> > and from a regular JAR file (outside the scope of apache).
>> > I think (And correct me if im wrong) I'm getting different MBean Servers.
>> > My question is - How Do I reach the Tomcat mbean server from outside or
>> > alternatively, how do I register the MBeans from inside apache with the
>> > "outside world" MBean server.
>> > The first option (Reach the Tomcat mbean server from the outside) is
>> > preferable.
>> > Thanks!!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to