• Post Reply Bookmark Topic Watch Topic
  • New Topic

another jmx/jboss question - abt dynamic mbeans and accessing properties file  RSS feed

Preetham Chandrasekhar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

getting past a new hurdle in jmx and coming across a new one - every day...but this one seems to be something that I am doing wrong...

I have a class which implements the dynamic mbean interface and I need it to access a properties file and make changes to the attributes in the properties file.

A sample code is given below:

public class ADMWPPropertyManager implements DynamicMBean {

private final String propertyFileName;
private final Properties properties;

public ADMWPPropertyManager(String propertyFileName) throws IOException {
this.propertyFileName = propertyFileName;
properties = new Properties();

public synchronized String getAttribute(String name)
throws AttributeNotFoundException {

String value = properties.getProperty(name);
if (value != null)
return value;
throw new AttributeNotFoundException("No such property: " + name);

//setAttribute(), setAttributes() and getAttributes() are implemented as well�

public synchronized MBeanInfo getMBeanInfo() {
SortedSet<String> names = new TreeSet<String>();
for (Object name : properties.keySet())
names.add((String) name);
MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[names.size()];
Iterator<String> it = names.iterator();
for (int i = 0; i < attrs.length; i++) {
String name = it.next();
attrs[i] = new MBeanAttributeInfo(
"Property " + name,
true, // isReadable
true, // isWritable
false); // isIs
MBeanOperationInfo[] opers = {
new MBeanOperationInfo(
"Reload properties from file",
null, // no parameters
return new MBeanInfo(
"Property Manager MBean",
null, // constructors
null); // notifications

I expect the code above to get a properties file from my system on start of the JBoss app server and I would like to make modifications to the properties file at runtime�.

The jboss-service.xml is given as follows:

<?xml version="1.0" encoding="UTF-8"?>
<mbean code="com.altair.adm.webportal.jmx.Startup" name="ZADMPortal:service=Startup">
<mbean code="com.altair.adm.webportal.jmx.ADMWPPropertyManager" name="ZADMPortal:service=ADMWPPropertyManager">
<attribute name="propertyFileName">C:\\temp\\wpParams.txt</attribute>

The �Startup� bean works fine�which implements a simple MBean interface�

However when the above dynamic bean is invoked�it gives the following exception�

org.jboss.deployment.DeploymentException: com.altair.adm.webportal.jmx.ADMWPPropertyManager.<init>(); - nested throwable: (java.lang.NoSuchMethodException: com.altair.adm.webportal.jmx.ADMWPPropertyManager.<init>())

I expect it to invoke the constructor with the propertyFileName...but it tries to initialize an default one?

am confused...

jithz jitthzn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasanth,

ive been trying to load the properties in the jboss conf folder via dynamic mbean and was unsuccessfull. Looks like it has been quite a while since you posted in this thread , have you come across a work around for this problem ?
Peter Johnson
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jithz jitthzn" please see your private messages regarding an important administrative matter.

Also, see this: TellTheDetails
It would help if you posted information about your properties and the code you are using to access them. Then we don't have to guess about what you might be doing wrong but can instead offer concrete advice.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!