Mantis - Resin
Viewing Issue Advanced Details
1390 major always 10-05-06 09:19 10-01-06 14:25
closed 3.0.21  
none 3.0.22  
0001390: Issues with registering Mbeans
After upgrading to 3.0.21, we started receiving the following exception for one of our MBeans:

2006-10-02 14:05:42 PDT] <SystemStartup> System - ERROR: Problem create HTTP Connector.
Exception: bad getter arg count
        at com.caucho.jmx.IntrospectionMBean.introspect(
        at com.caucho.jmx.IntrospectionMBean.<init>(
        at com.caucho.jmx.IntrospectionMBean.<init>(
        at com.caucho.jmx.AbstractMBeanServer.createMBean(
        at com.caucho.jmx.AbstractMBeanServer.registerMBean(
Caused by: bad getter arg count
        ... 10 more
One of our engineers has tracked down the problem, please find his analysis below.
Please let us know when we can expect this issue to be resolved.

Looks like a bug was instroduced in com.caucho.jmx.IntrospectionMBean. In the introspect(..) method there is a piece of code that handles cases where the class has a setter without a getter. In that scenario the code adds a attribute with null getter method. The MBeanAttributeInfo constructor is called with 4 attributes. It expects a getter method as 3rd attribute? and the implementation is passing in the setter which takes one argument? getters are not supposed have any arguments? hence \"bad getter arg count\" exception.

Here is the code from 3.0.21 and 3.0.14(version on my local) for comparision
----------------------------------------- Introspect(..) - lines 500-524

        else if (methodName.startsWith(\"set\") && args.length == 1) {
          String name = methodName.substring(3);

          Method getter = getGetter(methods, name, args[0]);

          if (getter == null) {
            String attributeName;

            if (isLowercaseAttributeNames) {
              StringBuilder builder = new StringBuilder(name);
              builder.setCharAt(0, Character.toLowerCase(builder.charAt(0)));
              attributeName = builder.toString();
              attributeName = name;

        if (attributes.get(attributeName) == null) {
                 new MBeanAttributeInfo(attributeName,
----------------------------------------------------------- : constructor code

    public MBeanAttributeInfo(String name,
                  String description,
                  Method getter,
                  Method setter) throws IntrospectionException {
         attributeType(getter, setter), --->> Exception is thrown in this method.
         (getter != null),
         (setter != null),

I compared it with the src from the version I am running.. 3.0.14:

Code from version 3.0.14:
----------------------------------------- Introspect(..) - lines 355-362

    else if (methodName.startsWith(\"set\") && args.length == 1) {
      String name = methodName.substring(3);

      Method getter = getGetter(methods, name, args[0]);

      if (getter == null)
        attributes.add(new MBeanAttributeInfo(name, name, null, method)); --->> notice order of parameters.

There are no notes attached to this issue.