9 Replies Latest reply on Apr 2, 2002 8:28 AM by Angela Whelan

    TestClient error

    Angela Whelan Newbie

      I am new to JBoss, and am trying to get the test\jboss\jmx\TestClient.java class working with my installation of JBoss. I am using version 2.4.4 of JBoss and it is running on a Solaris machine.When I run the TestClient code I get the following error :

      ----------------------------------------------------------

      Testing JMX Connector from client to server
      ===========================================

      1. Instantiate local MBeanServer and add connector factory as first MBean to search your net
      => hit any key to proceed

      ConnectorFactoryService.getObjectName(), server: com.sun.management.jmx.MBeanServerImpl@6e1408, object name: Factory:name=JMX, instance: Factory:name=JMX
      Found Factory: DefaultDomain:name=ConnectorFactory
      log4j:ERROR No appenders could be found for category (org.jboss.jmx.client.ConnectorFactoryService).
      log4j:ERROR Please initialize the log4j system properly.

      2. Lookup for all available connectors with the JNDI defined by jndi.properties
      => hit any key to proceed

      TestClient.main(), caught: javax.management.ReflectionException: The operation with name getConnectors could not be found, target: java.lang.NoSuchMethodException: getConnectors
      javax.management.ReflectionException: The operation with name getConnectors could not be found
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1620)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at jboss_test.TestClient.main(TestClient.java:103)
      ---------------------------------------------------------

      Does anyone have any idea what the problem could be ? Thanks very much for any help offered :)

        • 1. Re: TestClient error
          Adrian Brock Master

          Hi,

          I don't think that example works :-(
          Somebody else reported the same problem a few weeks ago.
          I've not had time to find out the problem.

          Regards,
          Adrian

          • 2. Re: TestClient error
            Angela Whelan Newbie

            Thanks very much for your response Adrian, I can now stop wasting time trying to figure out why it doesn't work !!

            I asked this question a little while ago, but, this still leaves me with the problem of not knowing how to connect to the JBoss JMX server via RMI, and be able to query the MBeans for information.

            As I am new to JBoss, the other examples that people gave me, I found difficult to figure out exactly what to do.

            Does anyone have some specific and simple Java code, which is suitable for newbies to JBoss, which connects via RMI to the JBoss JMX server, and querys the MBeans ?

            Thanks very much for any help offered

            • 3. Re: TestClient error
              Adrian Brock Master

              If I get some spare time this weekend, I'll try
              to get the example to work.
              Can't promise, I'll get any spare time though.

              Regards,
              Adrian

              • 4. Re: TestClient error
                Adrian Brock Master

                Hi,

                The problem with the example is easy to fix.
                Section 5 should be

                [pre]
                Iterator lConnectors = (Iterator) lLocalServer.invoke(
                lFactoryInstance.getObjectName(),
                "getConnectors",
                new Object[] {
                lProperties,
                lTester
                },
                new String[] {
                lProperties.getClass().getName(),
                - lTester.getClass().getName()
                + ConnectorFactoryImpl.IConnectorTester.getClass().getName()
                }
                );
                [/pre]

                Where - means remove the line
                and + means add the line

                Regards,
                Adrian

                • 5. Re: TestClient error
                  Angela Whelan Newbie

                  hi Adrian,
                  I've made that change to the code and I get the following error :
                  "TestClient.java": Error #: 308 : non-static method getClass() cannot be referenced from a static context at line 113, column 54

                  It seems some other changes need to be made that you may have forgotten to include...any ideas ?

                  Thanks for your help,
                  Angela

                  • 6. Re: TestClient error
                    Adrian Brock Master

                    Doh!

                    It should be .class.getName() of course.

                    Regards,
                    Adrian

                    • 7. Re: TestClient error
                      Angela Whelan Newbie

                      hi Adrian,
                      That worked, however, when I run the TestClient now, I get the following errors, any ideas ?

                      ---------------------------------------------------------

                      Testing JMX Connector from client to server
                      ===========================================

                      1. Instantiate local MBeanServer and add connector factory as first MBean to search your net
                      => hit any key to proceed

                      ConnectorFactoryService.getObjectName(), server: com.sun.management.jmx.MBeanServerImpl@6e1408, object name: Factory:name=JMX, instance: Factory:name=JMX
                      Found Factory: DefaultDomain:name=ConnectorFactory

                      2. Lookup for all available connectors with the JNDI defined by jndi.properties
                      => hit any key to proceed
                      log4j:ERROR No appenders could be found for category (org.jboss.jmx.client.ConnectorFactoryService).
                      log4j:ERROR Please initialize the log4j system properly.

                      javax.naming.ServiceUnavailableException: yourComputer. Root exception is java.net.UnknownHostException: yourComputer
                      at java.net.InetAddress.getAllByName0(InetAddress.java:571)
                      at java.net.InetAddress.getAllByName0(InetAddress.java:540)
                      at java.net.InetAddress.getByName(InetAddress.java:449)
                      at java.net.Socket.(Socket.java:100)
                      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:102)
                      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:776)
                      at org.jnp.interfaces.NamingContext.list(NamingContext.java:527)
                      at org.jnp.interfaces.NamingContext.list(NamingContext.java:520)
                      at javax.naming.InitialContext.list(InitialContext.java:390)
                      at org.jboss.jmx.client.ConnectorFactoryImpl.getConnectors(ConnectorFactoryImpl.java:71)
                      at org.jboss.jmx.client.ConnectorFactoryService.getConnectors(ConnectorFactoryService.java:55)
                      at java.lang.reflect.Method.invoke(Native Method)
                      List of all available connectors on your net
                      =========================================

                      3. Select your connector by entering its number
                      => hit any key to proceed
                      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
                      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
                      at jboss_test.TestClient.main(TestClient.java:103)

                      TestClient.main(), caught: java.util.NoSuchElementException
                      java.util.NoSuchElementException
                      at java.util.AbstractList$Itr.next(AbstractList.java:423)
                      at jboss_test.TestClient.main(TestClient.java:138)
                      ---------------------------------------------------------


                      Thanks very for any help on this,
                      Angela

                      • 8. Re: TestClient error
                        Adrian Brock Master

                        What do you have as your jndi.properties?
                        Looks like it cannot find the provider.

                        Regards,
                        Adrian

                        • 9. Re: TestClient error
                          Angela Whelan Newbie

                          hi Adrian,
                          The jndi.properties was the problem, I had one of the settings wrong, the example now works :D

                          Thanks very much for all your help !

                          Angela