1 2 Previous Next 20 Replies Latest reply on May 10, 2002 3:49 AM by juha Go to original post
      • 15. Re: NullPointerException
        angelawhelan

        hi,
        I have also found that the following code :

        // Take the first server and its first protoccol and create a
        // connection to the remote MBeanServer
        JMXConnector lConnector = (JMXConnector) lLocalServer.invoke(
        lFactoryInstance.getObjectName(),
        "createConnection",
        new Object[] {lConnectorName},
        new String[] {lConnectorName.getClass().getName()}
        );

        produces the following error :

        javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:646)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
        at javax.naming.InitialContext.getEnvironment(InitialContext.java:475)
        at org.jboss.jmx.client.RMIClientConnectorImpl.start(RMIClientConnectorImpl.java:91)
        at org.jboss.jmx.client.RMIClientConnectorImpl.(RMIClientConnectorImpl.java:77)
        at org.jboss.jmx.client.ConnectorFactoryImpl.createConnection(ConnectorFactoryImpl.java:101)
        at org.jboss.jmx.client.ConnectorFactoryService.createConnection(ConnectorFactoryService.java:61)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
        at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
        at CustomMonitor.MBeanMonitor.update(MBeanMonitor.java:247)
        at COM.freshtech.SiteScope.AtomicMonitor.testUpdate(AtomicMonitor.java)
        at MonitorRunner.main(MonitorRunner.java)

        Even though the JNDI properties are set up correctly.

        Does anyone have any ideas ?

        Thanks in advance,
        A.

        • 16. Re: NullPointerException

          you probably tried it already but...

          can you double check your jndi.properties file is found by the classloader trying to create the InitialContext?

          -- Juha

          • 17. Re: NullPointerException
            angelawhelan

            hi Juha,
            I'm not sure how to check this, but, I looked at http://host:8082 and went to service=JNDIView and listed everything bound in JNDI and I found :
            +- jmx:sun02:rmi (class: org.jboss.jmx.server.RMIConnectorImpl)

            Is this what you are looking for ? If not, would you please give me some more information about what you suggested ? Thanks !

            I had an idea actually, that the problem might be that the environment that I am trying to connect to JBoss from might not be able to resolve the hostname : sun02 to an IP address...could this be the problem ? If so, how do I change the configuration to allow for this.

            Thanks very much for any help.

            A.

            • 18. Re: NullPointerException

              well, looking back I see Adrian already suggested this.

              what you see at port 8082 is how things look at the server side. However, you need to setup the JNDI properties for your client application. This means that you must make sure the jndi.properties file is found in the client's classpath (and as Adrian said, also make sure the jnp-client.jar is included in the client's classpath).

              So classloader.getResource("jndi.properties") or classloader.getSystemResource("jndi.properties") (in case of a trivial client application) should return a non-null URL that points to your jndi.properties file on the client side.

              The error javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial seems to indicate that the jndi.properties are not in the client's classpath.

              -- Juha

              • 19. Re: NullPointerException
                angelawhelan

                Juha !
                Thank you sooooooooo much !!!

                That worked !

                I have been banging my head against a wall for about 3 weeks trying to solve that problem !!

                I know Adrian said the same thing as you, but I thought he was talking about the server side initial context, and it was only when you said that you need to have jndi.properties on the client side as well as the server side that I understood what the problem was and what Adrian was trying to tell me all along !

                Well done to the JBoss team !!

                Thanks again so much to both !!

                yours in happy programming land :)
                Angela.

                • 20. Re: NullPointerException

                  You're welcome :)

                  Sorry it took three weeks to solve, hope your head doesn't hurt too much ;)

                  -- Juha

                  1 2 Previous Next