I haven't looked at the JMX plugin code but I suspect it is because you are using
org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent - that class probably expects the
parent resource to be a JMXServerComponent (that's how it plans on getting its
connection to the JMX server - it asks the parent for it.) Once it gets the connection, it
can then issue some JMX queries to try to discover your service.
So your parent class
<server name="MyServer"
discovery="MyServerDiscoveryComponent"
class="MyServerComponent"
doesn't match what is expected.
Anyway, that may not be the full explanation, but I'm betting its pretty close.
----- Original Message -----
I'm trying to include the JMX/JVM as a sub-server for one of my
processes in
my RHQ plugin under RHQ 3.0. I'm following the documentation on the wiki (
https://docs.jboss.org/author/display/RHQ/AMPS-Plugin+Extensions ) and also
referenced the jboss-as RHQ plugin in the same source tree. I think I've got
all the bases covered with one exception, but it's not working. Any ideas?
1) added JMX depends to the rhq-plugin.xml:
<depends plugin="JMX" useClasses="true"/>
2) I've SKIPPED the runs-inside as I wish the plugin to be placed under the
parent platform instead of burried along with all the JMX services.
<runs-inside>
<parent-resource-type name="JMX Server" plugin="JMX" />
</runs-inside>
3) added a JVM server to MyServer to test:
<server name="MyServer"
discovery="MyServerDiscoveryComponent"
class=" MyServer Component"
description=" MyServer Service"
singleton="true">
<process-scan name="unix"
query="process|basename|match=^java*,arg|-classpath|match=.*/foo.bar.myserver\.jar.*"
/>
<metric property="version"
displayName="MyServer Version"
dataType="trait"
displayType="summary"
defaultInterval="900000"/>
<server name="MyServer JVM"
description="JVM"
sourcePlugin="JMX"
sourceType="JMX Server"
discovery="org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent"
class="org.rhq.plugins.jmx.JMXServerComponent"
singleton="true">
</server>
3) agent.log shows the following:
2013-04-16 17:46:56,109 WARN [InventoryManager.discovery-1]
(rhq.core.pc.inventory.InventoryManager)- Failure during discovery for
[MyServer JVM] Resources - failed after 1 ms.
java.lang.Exception: Discovery component invocation failed.
at
org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:283)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: foo.bar.MyServerComponent cannot be
cast to org.rhq.plugins.jmx.JMXComponent
at
org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent.discoverResources(EmbeddedJMXServerDiscoveryComponent.java:56)
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:279)
_______________________________________________
rhq-users mailing list
rhq-users(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/rhq-users