2 Replies Latest reply on Mar 14, 2005 7:46 PM by Vijay Kandy

    java.lang.IllegalArgumentException: name is not a valid java

    Vijay Kandy Newbie

      Hello,

      I have a bunch of 3rd pary MBeans that work (deploy without errors) in JBoss-3.2.3. But when I deploy in JBoss-3.2.6, I get the following exception.

      2005-03-14 13:03:51,693 [main] INFO STDOUT - java.lang.IllegalArgumentException: name is not a valid java type (or is a reserved word): class name
       2005-03-14 13:03:51,713 [main] INFO STDOUT - at javax.management.MBeanFeatureInfo.<init>(MBeanFeatureInfo.java:68)
       2005-03-14 13:03:51,714 [main] INFO STDOUT - at javax.management.MBeanParameterInfo.<init>(MBeanParameterInfo.java:50)
       2005-03-14 13:03:51,714 [main] INFO STDOUT - at com.sun.jdmk.comm.HtmlAdaptorServer.buildInfo(HtmlAdaptorServer.java:1174)
       2005-03-14 13:03:51,714 [main] INFO STDOUT - at com.sun.jdmk.comm.HtmlAdaptorServer.<init>(HtmlAdaptorServer.java:187)
       2005-03-14 13:03:51,714 [main] INFO STDOUT - at com.sun.jdmk.comm.HtmlAdaptorServer.<init>(HtmlAdaptorServer.java:174)
       2005-03-14 13:03:51,714 [main] INFO STDOUT - at com.infosys.j2ee.infrastructure.component.utils.JMXRIDelegate.registerHtmlAdaptor(JMXRIDelegate.java:96)
      


      The line that throws this exception is highlighted:
      public void registerHtmlAdaptor() throws JMXUtilsException{
       if (htmlAdaptorServer == null){
       ObjectName htmlAdaptorName=null;
       String domainName=null;
      
       try{
       domainName=mbserver.getDefaultDomain();
       htmlAdaptorServer=new HtmlAdaptorServer();
       htmlAdaptorName=new ObjectName(domainName +":type=htmladaptor");
       htmlAdaptorServer.setPort(portNumber);
       mbserver.registerMBean(htmlAdaptorServer, htmlAdaptorName);
       } catch (InstanceAlreadyExistsException e) {
       //ignore
       }catch(Exception e){
      
       e.printStackTrace();
      
       String errMsg = "Error while registring HTML Adaptor with MBeanServer";
       throw new JMXUtilsException(errMsg, e);
      
       }
       }
       }
      


      Since this works in Jboss-3.2.3, I am thinking this has to do with JMX version. Can anyone suggest what the problem might be?

      Thank you,
      Vijay Kandy

        • 1. Re: java.lang.IllegalArgumentException: name is not a valid
          Dimitris Andreadis Master


          This is fixed in JBoss HEAD and 4.x from 2004/4/28 (but not in the 3.2.x branch after 3.2.3).

          The explanation is below:

          "Update to jmx-1.2mr change for Illegal identifiers no longer produce exceptions (4839259) Version 1.1 of the spec said that identifiers in MBeans (class name strings, attribute, operation, and paramter names) should be valid Java identifiers, but did not enforce this. In version 1.2, the constructors of the various MBean*Info classes were modified so that they do enforce this requirement. This change broke existing code, as people in fact used non-Java-identifiers here.

          The correction is that in the constructors for the classes BeanAttributeInfo,
          MBeanConstructorInfo, MBeanFeatureInfo, MBeanInfo, MBeanNotificationInfo, MBeanOperationInfo, MBeanParameterInfo, the exception IllegalArgumentException is no longer thrown for illegal names."

          • 2. Re: java.lang.IllegalArgumentException: name is not a valid
            Vijay Kandy Newbie

            Thank you. Code works well in Jboss-4.0.1.

            Vijay Kandy