Hi Xilai,

you have to provide principal/credentials for the JMX connection (username/password).

Regards
JB

On 06/26/2014 07:57 AM, XiLai Dai wrote:
Hi,

With these codes running in the karaf 3.0.1:

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;

import javax.management.ObjectName;

……

MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem");

AttributeList list = mbs.getAttributes(name, new String[] {
"SystemCpuLoad" });

And also created a ACL configuration file etc/
jmx.acl.java.lang.OperatingSystem.cfg  (one line for enable access to
all attributes)

* = admin

But still got the SecurityException:

karaf@root()> Exception in thread "Thread-49"
java.lang.SecurityException: Insufficient roles/credentials for operation

         at
org.apache.karaf.management.KarafMBeanServerGuard.handleInvoke(KarafMBeanServerGuard.java:228)

         at
org.apache.karaf.management.KarafMBeanServerGuard.handleGetAttribute(KarafMBeanServerGuard.java:192)

         at
org.apache.karaf.management.KarafMBeanServerGuard.handleGetAttributes(KarafMBeanServerGuard.java:197)

         at
org.apache.karaf.management.KarafMBeanServerGuard.invoke(KarafMBeanServerGuard.java:65)

         at
org.apache.karaf.management.boot.KarafMBeanServerBuilder$MBeanInvocationHandler.invoke(KarafMBeanServerBuilde

r.java:63)

Any ideas?

Regards.

Xilai Dai


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to