1 Reply Latest reply on Feb 4, 2003 5:36 PM by Faith Ildiz

    Error querying MEJB reference

    simone Newbie

      I'm getting this error on line 5

      java.rmi.ServerException: RuntimeException; nested exception is:
      java.lang.IllegalArgumentException: wrong number of arguments

      java.lang.IllegalArgumentException: wrong number of arguments

      this is the code snippet

      Management mejb=(Management) PortableRemoteObject.narrow(home.create(), Management.class);
      3. String domain = mejb.getDefaultDomain();
      4. ObjectName objName = new ObjectName(domain+":"+"j2eeType=EJBModule,*");
      5. Set names = mejb.queryNames(objName, null);
      6. Iterator itr = names.iterator();
      7. while(itr.hasNext()) {
      8. ObjectName name = (ObjectName)itr.next();
      9. String strKeyProperty = name.getKeyProperty(str1);
      10. String strKeyProperty1 = name.getKeyPropertyListString();
      11. ObjectName[] ejbs = (ObjectName[])mejb.getAttribute(name, "EJBs")

      Any help will be appreciated...
      Simone

        • 1. Re: Error querying MEJB reference
          Faith Ildiz Newbie

          I do not know what may be wrong with your code (besides the initial line does not compile in my environment). Anyway the code works fine as below (JBoss-3.2.0-Beta)

          InitialContext ctx = new InitialContext();
          Object o = ctx.lookup("ejb/mgmt/MEJB");
          ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(o, ManagementHome.class);
          Management mejb = home.create();

          String domain = mejb.getDefaultDomain();
          ObjectName objName = new ObjectName(domain+":"+"j2eeType=EJBModule,*");
          Set names = mejb.queryNames(objName, null);
          Iterator itr = names.iterator();
          while(itr.hasNext()) {
          ObjectName name = (ObjectName)itr.next();
          System.out.println("EJBModule: " + name);
          String strKeyProperty = name.getKeyPropertyListString();
          System.out.println("EJBProps : " + strKeyProperty);
          ObjectName[] ejbs = (ObjectName[])mejb.getAttribute(name, "EJBs");
          }