-
1. Re: BeanMetaData and management
alesj Nov 24, 2008 4:00 AM (in response to bob.mcwhirter)"bob.mcwhirter" wrote:
I've attempted to add @JMX annotations, but got either a mixture of "nothing" or "already installed" errors.
This should work.
I don't see how you can get "nothing".
Or what are the exact "already installed" errors?
As mbean's ObjectName is derived from bean name,
hence it should be unique if your bean name is unique."bob.mcwhirter" wrote:
I also tried to gain a clue about Scott's @ManagementObject/ManagedObject stuff, but also never got anything visible in the jmx-console.
Currently you only get this visibility in ProfileService (PS).
Then some admin console needs to use PS to show content."bob.mcwhirter" wrote:
Should I be looking for some other console (JOPR-embedded?), or is there some way to wire things up to automatically appear in JMX consoles?
Yes, jopr/embedded is probably the only admin console that somehow knows PS,
but even this is not yet fully implemented.
We still have some issues in Managed/Metatype MC sub-project,
PS attachment/MO serialization and jopr/embedded generic plugins.
I would look into why @JMX doesn't work for you,
as that's the easiest way to wire things up. -
2. Re: BeanMetaData and management
alesj Nov 24, 2008 4:09 AM (in response to bob.mcwhirter)"bob.mcwhirter" wrote:
or is there some way to wire things up to automatically appear in JMX consoles?
And you can even add @JMX on a property.
- http://anonsvn.jboss.org/repos/jbossas/projects/demos/microcontainer/trunk/models/src/main/java/org/jboss/demos/models/jmx/ExposePojo.java
This requires you to add property annotation plugin that handles this:
- http://anonsvn.jboss.org/repos/jbossas/projects/demos/microcontainer/trunk/jmx/src/main/resources/META-INF/varia-deployers-beans.xml -
3. Re: BeanMetaData and management
bob.mcwhirter Nov 24, 2008 8:55 AM (in response to bob.mcwhirter)Thanks for the response Ales--
So, my "nothing" result was me applying @JMX to the wrong class, one not instantiated by MC.
My "already installed" error occurs when I get the @JMX annotation on the correct class, but give my object a bogus MC bean name (in this case "jboss.rails:name=oddthesis").
The error I was getting is here, in case you're interested. "Already installed" was somewhat confusing of an error to get.
http://oddthesis.pastebin.com/f46537bdf
I was expecting to find a JMX object named "jboss.rails:name=oddthesis"
Once I named it more simply "jboss.rails.oddthesis" (using unit.getSimpleName(), if that's recommended?), it deployed just fine, and I can find my mbean under "jboss.pojo" domain successfully.
I see I can set the 'name' parameter on @JMX, but is there another way to dynamically set the JMX object-name (to include some bit of unit.getSimpleName() perhaps) like I think the @ManagementObjectID annotation supports on that side of things? Ultimately, I think I'd like to end up with "jboss.rails:name=#{unit.getSimpleName()}" or similar.
Or should I give up, admit JMX is dead, and move on?
Thanks!
Bob -
4. Re: BeanMetaData and management
alesj Nov 24, 2008 9:32 AM (in response to bob.mcwhirter)"bob.mcwhirter" wrote:
My "already installed" error occurs when I get the @JMX annotation on the correct class, but give my object a bogus MC bean name (in this case "jboss.rails:name=oddthesis").
This is the code that creates the name:
- http://anonsvn.jboss.org/repos/jbossas/trunk/system-jmx/src/main/org/jboss/system/microcontainer/jmx/AbstractServiceControllerLifecycleCallback.java
If your bean name contains ':' it's gonna be used."bob.mcwhirter" wrote:
The error I was getting is here, in case you're interested. "Already installed" was somewhat confusing of an error to get.
http://oddthesis.pastebin.com/f46537bdf
You have duplicated name.
Your bean and mbean are named the same, hence MC Controller complained.
Thinking about how we create the name, it's not very good.
I'll raise an issue about this."bob.mcwhirter" wrote:
I see I can set the 'name' parameter on @JMX, but is there another way to dynamically set the JMX object-name (to include some bit of unit.getSimpleName() perhaps) like I think the @ManagementObjectID annotation supports on that side of things? Ultimately, I think I'd like to end up with "jboss.rails:name=#{unit.getSimpleName()}" or similar.
The problem here is that when @JMX interceptor kicks in,
you don't have access to DeploymentUnit, since you might even not have any DU.
e.g. programmatic ControllerContext installation
But I'll check what can be done,
to make name creation as configurable as possible.
e.g. pulling some info from CC's MetaData"bob.mcwhirter" wrote:
Or should I give up, admit JMX is dead, and move on?
It depends how much work is there.
For now I would still use it.
But as soon as you see some lively movement in jopr/embedded wrt PS,
I would change to ManagedObject. -
5. Re: BeanMetaData and management
bob.mcwhirter Nov 24, 2008 9:43 AM (in response to bob.mcwhirter)Excellent explanation, Ales, thanks!
I'm happy to live for jboss.pojo for now.
I like the @ManagementObjectID (assuming I'm understanding it correctly). Or some way to mark a method as "call this to figure out the JMX ObjectName string".
ie.
@JMXObjectName
public String myFancyObjectNameGeneratorOnMyMBean() {
return "cheese:name=" + simpleName;
}
Bob -
6. Re: BeanMetaData and management
bob.mcwhirter Nov 24, 2008 11:53 AM (in response to bob.mcwhirter)For what it's worth, it seems the instance-level annotation capability was the solution. I added something like:
builder.addAnnotation("@org.jboss.aop.microcontainer.aspects.jmx.JMX(registerDirectly=true, exposedInterface=void.class, name=\"jboss.rails.web:app=" + unit.getSimpleName() + "\")");
And now I get no installation errors, and it appears in jmx-console as I expect it to.
MC FTW!
-Bob -
7. Re: BeanMetaData and management
alesj Nov 24, 2008 3:24 PM (in response to bob.mcwhirter)"bob.mcwhirter" wrote:
@JMXObjectName
public String myFancyObjectNameGeneratorOnMyMBean() {
return "cheese:name=" + simpleName;
}
This makes sense and can be easily added. -
8. Re: BeanMetaData and management
alesj Nov 24, 2008 3:25 PM (in response to bob.mcwhirter)"alesj" wrote:
"bob.mcwhirter" wrote:
@JMXObjectName
public String myFancyObjectNameGeneratorOnMyMBean() {
return "cheese:name=" + simpleName;
}
This makes sense and can be easily added.
I'll let you implement it. :-)
Nah, just kiddin'. I'll try to add it before we go GA. -
9. Re: BeanMetaData and management
alesj Nov 24, 2008 3:30 PM (in response to bob.mcwhirter)"bob.mcwhirter" wrote:
For what it's worth, it seems the instance-level annotation capability was the solution.:
Nice.
Forgot you are 'inside' a deployer. :-)"bob.mcwhirter" wrote:
MC FTW!
FTW?
- http://www.google.com/search?source=ig&hl=en&rlz=&=&q=define%3AFTW&btnG=Google+Search&aq=f -
10. Re: BeanMetaData and management
alesj Nov 25, 2008 8:59 AM (in response to bob.mcwhirter)"alesj" wrote:
"alesj" wrote:
"bob.mcwhirter" wrote:
@JMXObjectName
public String myFancyObjectNameGeneratorOnMyMBean() {
return "cheese:name=" + simpleName;
}
This makes sense and can be easily added.
I'll let you implement it. :-)
Nah, just kiddin'. I'll try to add it before we go GA.
- https://jira.jboss.org/jira/browse/JBMICROCONT-390
But I forgot to add it with 2.0.0.GA,
due to frenzy with JBoss Reflect bug. ;-(
But it's out there, so it will get in eventually. ;-)