1 Reply Latest reply on Sep 25, 2002 11:57 AM by Juha Lindfors

    createMBean problem with primitive types arguments

    Boris Petrovic Newbie

      Hello there,

      I wrote a snippet of code which need programatically to create Scheduler and invoke start ( I'm using user predefined property file).

      When I wrote something like this ( similar example found on the net ):
      ObjectInstance lScheduler = lServer.createMBean("org.jboss.varia.scheduler.Scheduler",new ObjectName("jboss.util:service=Scheduler,type=ScheduleHouseKeeping"),new Object[] {
      //pSchedulableClass
      "nl.virgil.yards.config.data.fd0.mbean.ScheduleHouseKeeping",
      //pInitArguments
      "dummy param",
      //pInitTypes
      "java.lang.String",
      //pInitialStartDate
      "NOW",
      //pSchedulePeriod
      new Long(interval),
      //pNumberOfRepetitions
      new Long(-1)
      },
      new String[] {
      "java.lang.String",
      "java.lang.String",
      "java.lang.String",
      "java.lang.String",
      "long",
      "long"
      }
      );


      I get a message :
      16:15:30,249 ERROR [MBeanServerImpl] Unhandled exception instantiating class: org.jboss.varia.scheduler.Scheduler
      ReflectionException: Constructor parameter class not found: long
      Cause: java.lang.ClassNotFoundException: long
      Obviously it can't figure out primitive long types in arguments signature

      Later when I tried to put "java.lang.Long" as a signature type I get this message:
      Depends On Me: ReflectionException: org.jboss.varia.scheduler.Scheduler does not have a public no args constructor.
      Cause: java.lang.NoSuchMethodException]


      Any idea where I'm wrong?