I have configured the James server and added some user and domains to it.
From the Jconsole i am able to get the list of users as shown in below image.
Can anyone please provide me the code snippet to get same through the JMX
as James documentation specify this To add user Programatically by JMX
Somehow i manage to get the code snippet work but unable to find how to call the operations of Mbean without any parameter.
This code is printing attributes of Mbean
String url = "service:jmx:rmi://localhost/jndi/rmi://localhost:9999/jmxrmi";
JMXServiceURL serviceUrl = new JMXServiceURL(url);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceUrl, null);
try {
MBeanServerConnection mbeanConn = jmxConnector.getMBeanServerConnection();
ObjectName mbeanName = new ObjectName("org.apache.james:type=component,name=usersrepository");
MBeanInfo info = mbeanConn.getMBeanInfo(mbeanName);
MBeanAttributeInfo[] attributes = info.getAttributes();
for (MBeanAttributeInfo attr : attributes)
{
System.out.println(attr.getDescription() + " " + mbeanConn.getAttribute(mbeanName,attr.getName()));
}
} finally {
jmxConnector.close();
}
Please help in getting this code work to get the Users List.
