4 Replies Latest reply on Aug 31, 2002 6:40 PM by juha

    CreateMBean, constructor with primitive data types no more s

    mpriha

      Hi,
      We have a system applying MBeans and we have tried both Sun's Reference and JBoss JMX implementations. In spring we were very happy how easy it was to switch from Sun RI to JBossJMX.

      Now with the version downloaded 7.8. we have met this problem. Constructors with primitive data types are no more supported but we get an exception in MBeanServerImpl#instantiate
      "Constructor parameter class not found: int"

      Is this a deliberated change or a coincidence?

      (In the source file there is a comment "FIXME: should we delegate to DLR before throwing the exception?" but I am not sure if it has anything to do with my finding)

      Marketta

        • 1. Re: CreateMBean, constructor with primitive data types no mo

          If it used to work but doesn't anymore then this is a bug. Can you post a bug report, do you have a test case we can use?

          -- Juha

          • 2. Re: CreateMBean, constructor with primitive data types no mo
            mpriha

            Our system is quite large but here is one sample constructor code and the work around we had to make. I can make a bug report later but I wonder do you not have in your test cases these kind of tests?

            public class PooledExecutor
            extends ThreadExecutor
            implements PooledExecutorMBean
            {
            ...
            /**
            * Constructs a new pooled executor.
            *
            * @param factory the object name of the thread factory.
            * @param capacity the capacity of a command queue.
            */
            public PooledExecutor(ObjectName factory,
            int capacity)
            {
            super(factory);
            queueCapacity = capacity < 0 ? 0 : capacity;
            }

            /**
            * Constructs a new executor with java.lang.Integer parameters
            * as some MBean servers have difficulties with ints.
            *
            * @param factory the object name of the thread factory.
            * @param capacity the capacity of a command queue.
            */
            public PooledExecutor(ObjectName factory,
            Integer capacity)
            {
            this(factory, capacity.intValue());
            }

            • 3. Re: CreateMBean, constructor with primitive data types no mo

              From the BasicLoaderRepository

              // REVIEW: Is this the correct place for this or should it only
              // go where signatures are checked?
              // JPL: looks ok to me
              // JPL: however there is not guarantee that the BasicLR is installed
              // as the loader repository for all server instances.

              // Check for native classes
              Class clazz = (Class) nativeClassBySignature.get(className);
              if (clazz != null)
              return clazz;

              Of course, this is not in the UnifiedLoaderRepository

              Regards,
              Adrian

              • 4. Re: CreateMBean, constructor with primitive data types no mo

                ok,

                so the quick fix is to switch back to basic loader and not use unified then... you can either hard code this into serverconstants.java (default loader repository, this should not have had changed in the first place) or there's a system property string that you can use (I can't remember the values right now but chances are it's documented in the ServerConstants.java file.

                We need to build the test suite to run with all different plugins installed from now on.. this kinda thing should not happen.

                -- Juha