on 03-11-2008 9:00 AM
Hi Experts,
concerning a monitoring of java applications, i am trying to register a simple Mbean. I´ve followed the manual
and tried this code.
InitialContext ctx = new InitialContext();
MBeanServer mbs = (MBeanServer) ctx.lookup("jmx");
ObjectName name = new ObjectName("Ccmx.monitor:name=freespace");
mbs.registerMBean(new Free_space(), name);
or this
InitialContext ctx = new InitialContext();
MBeanServer mbs = (MBeanServer) ctx.lookup("jmx");
Free_space mbean = new Free_space();
ObjectName name =
ObjectNameFactory.getNameForServerChildPerNode(
"My_Free_Space",
"Free_space",
null,
null);
//
mbs.registerMBean(mbean, name);
I´ve already have a public interface and implements my methods, finally i got a MBeanRegistrationException
--> Not a compliant standard MBean.
?? Where is the mistake, or how looks a standard Mbean?
thanks for help....
Hi,
It could be an AccessPriviledge problem.
Only an adminstrator can register or unregister Mbeans.
So for example, if this code is called from a servlet then this servlet should be running under administrator priviledges ie.
Example:
Web.xml
<servlet>
<servlet-name>InitializationServlet</servlet-name>
<servlet-class>com.sap.InitializationServlet</servlet-class>
<run-as>
<role-name>AdminRoleForRegisteringMBean</role-name>
</run-as>
</servlet>
<security-role>
<role-name>AdminRoleForRegisteringMBean</role-name>
</security-role>
Web-j2ee-engine.xml
<security-role-map>
<role-name>AdminRoleForRegisteringMBean</role-name>
<server-role-name>administrators</server-role-name>
</security-role-map>
Hope this helps.
Best Regards, Gagan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.