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>
<bruno.wassermann(a)googlemail.com>
To: "jopr-dev" <jopr-dev(a)lists.jboss.org>
<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
listjopr-dev@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/jopr-dev
_______________________________________________
jopr-dev mailing
listjopr-dev@lists.jboss.orghttps://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