tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Cohen <sco...@javactivity.org>
Subject Re: Need help with Tomcat MBean support
Date Mon, 08 Sep 2008 17:44:57 GMT
I sent this in over the weekend and didn't get a response so let me try 
this again a bit differently.

The Sun JDK 5.0 JMX tutorial shows that it is possible and simple to 
create JMX client and JMX server in separate JVMs and have them talk to 
each other.

The first article cited by Mr. Hall shows that it is possible and simple 
to create a JMX server running inside Tomcat and talk to it through 
tools such as MC4J and JManage.

I need to combine the Server side approach recommended by the article 
(JMX server within Tomcat webapp) with the Client side approach 
recommended by Sun in their tutorial. 

So far my client-side app can connect to the MBean server inside of 
Tomcat and talk to it but it fails to create the MBean needed to 
interact with the server because of ClassLoader issues.

Questions: 
1. Is this even possible?  It would seem to be so since MC4J and JManage 
know how to do it.
2. If so, how do I surmount these ClassLoader issues?

Thank you very much.

Steve Cohen wrote:
> Okay using approach of first article.  The MBean server is correctly 
> initialized and everything on the server side looks good.
>
> Now we come to the client side.  The first article assumes you are 
> just going to connect using a tool such as MC4J or JManage (monitoring 
> tools).
>
> That is not my use case.  I want to write a command-line client that 
> can talk to the MBean (which is inside of Tomcat) and invoke an 
> operation on the MBean.
>
> I use the Client.java sample from the Sun tutorial as a starting point.
>
> I am able to connect to the server, and get a list of MBeans, but I 
> fail when trying to call createMBean().  I am using the simple 
> two-parameter version of createMBean() and it always fails with
>
> javax.management.ReflectionException: The MBean class could not be 
> loaded by the default loader repository
>
> It seems pretty clear that my client needs to use one of the other 
> versions of createMBean(), one that specifies some other Class Loader 
> but I have no clue what I should be using for that.
>
>
> H. Hall wrote:
>> Steve Cohen wrote:
>>> Let me ask my question a little more directly:
>>>
>>> Does the presence of a descriptor cause instantiation of an instance 
>>> of an MBean
>>> or do I have to write code to create a server-side instance of my 
>>> MBean and if so, where should this code reside
>>> or is there some configuration artifact that causes this 
>>> instantiation to happen?
>>>
>>>
>>
>> Why don't you take a look at these two articles:
>> http://today.java.net/pub/a/today/2005/11/15/using-jmx-to-manage-web-applications.html?page=1

>>
>>
>> http://marxsoftware.blogspot.com/2008/07/jmx-model-mbeans-with-apache-commons.html

>>
>>
>> If you use the NetBeans IDE you might be interested in the JMX plugin 
>> for NB. Here is a link to a tutorial "Getting Started with JMX 
>> Monitoring in NetBeans IDE 6.0"
>>
>> http://www.netbeans.org/kb/60/java/jmx-getstart.html
>>
>> cheers,
>> HH
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message