That's probably ok.
The reason for the use of EMS in many of our plugins is because we need to suppot the
use-case where an agent is managing multiple instances of the same kind of product, but
perhaps different versions - where those different versions have different implementations
of JMX or supporting/dependent classes.
If you don't have that requirement (i.e. if you are only going to monitor one or more
of the SAME versioned product) you're OK.
For example, JBossAS 3 and 4 have their own implementations of JMX and are different
between each other (i.e. the client jars are different). Using EMS (and its classloading
facilities) help isolate those implementations so we can manage JBoss 3 and Jboss 4 by the
same agent.
The same thing happens if an MBean has an attribute or operation that returns different
implementations of classes. If you have an agent managing product version 1 and version 2,
where both have an attribute of type "Foo" then you need classloader isolation
in the case where version 1 and version 2 have different versions of that class definition
Foo.
In general, if you need to use different client jars to manage different version of the
same product managed by your plugin, you need to use some kind of isolation (the new Jopr
stuff has this too, in case you don't want to use EMS - see the Plugin Classloaders
wiki page I mentioned earlier).
----- Original Message -----
From: "Bruno Wassermann" <bruno.wassermann(a)googlemail.com>
To: "Jay Shaughnessy" <jshaughn(a)redhat.com>
Cc: "John Mazzitelli" <mazz(a)redhat.com>, "jopr-dev"
<jopr-dev(a)lists.jboss.org>
Sent: Sunday, August 9, 2009 11:47:04 AM GMT -05:00 US/Canada Eastern
Subject: Re: [jopr-dev] EmsException?
I'm still not sure what's going on there. I replaced EmsConnection with
javax.management.* classes and can successfully get the attribute value like that. I am
tempted to look into it some more, but am under a tiny little bit of time pressure and for
now am happy to have this piece working...
-- Bruno
On Fri, Aug 7, 2009 at 9:48 PM, Jay Shaughnessy < jshaughn(a)redhat.com > wrote:
Looking at the code this seems to get thrown from the
attrib.getValue(); It's unclear why you'd get null as the argument but this
certainly leans torward the attribute being unknown to the bean.
John Mazzitelli wrote:
EmsBean bean = connection.getBean(AE_WEBMODULE_BEAN);
String aePath = bean.getAttribute("path").getValue().toString();
Which line throws that exception? You should temporarily break this up so you can get a
good indication of where that error comes from:
EmsBean bean = connection.getBean(AE_WEBMODULE_BEAN);
Attribute attrib = bean.getAttribute("path")
Object value = attrib.getValue();
String aePath = value.toString();
I'll assume bean is coming back non-null (other wise, the next line would throw an
NPE).
If the getAttribute() is the one throwing it, I'll assume your MBean does not have a
"getPath()" method on it.
Just a guess but that's what I would look at... see what attributes the
AE_WEBMODULE_MBEAN has on it and make sure it has a readable "getPath" no-arg
attribute method on it.
----- Original Message -----
From: "Bruno Wassermann" <bruno.wassermann(a)googlemail.com> To:
"jopr-dev" <jopr-dev(a)lists.jboss.org> Sent: Thursday, August 6, 2009
1:39:28 PM GMT -05:00 US/Canada Eastern
Subject: [jopr-dev] EmsException?
Hi again,
I have come across some weird(seeming) problem. In my ActiveBPEL discovery component, I
connect to the JMX server on my Tomcat instance to look up the existence of a bean and
extract a value from it, like so:
private final static String AE_WEBMODULE_BEAN =
"Catalina:j2eeType=WebModule,name=//localhost/active-bpel,J2EEApplication=none,J2EEServer=none";
....
EmsConnection connection = null;
try {
connection = context.getParentResourceComponent().getEmsConnection();
EmsBean testBean = connection.getBean("Catalina:type=Server");
String testPort = testBean.getAttribute("port").getValue().toString();
log.debug(LOG_PREFIX + "THE PORT BEAN: " + testPort);
log.debug(LOG_PREFIX + "CONNECTION URL: " +
connection.getConnectionProvider().getConnectionSettings().getServerUrl());
EmsBean bean = connection.getBean(AE_WEBMODULE_BEAN);
String aePath = bean.getAttribute("path").getValue().toString();
The poor agent ends up complaining as follows: EmsException: Could not load attribute
value null.
Now, the same code works for retrieving a very similar MBean for Axis, the ActiveBPEL
MBean name I'm using seems to be okay, testPort above is as expected. Why would it not
be able to get the bean and its attributes?
Has anyone come across this in a similar context? I have read something about a Jopr/RHQ
bug that results in the same exception...
Thanks,
-- Bruno
_______________________________________________
jopr-dev mailing list jopr-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jopr-dev
_______________________________________________
jopr-dev mailing list jopr-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jopr-dev
_______________________________________________
jopr-dev mailing list
jopr-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jopr-dev