6 Replies Latest reply on May 28, 2004 1:51 PM by raja05

    Problem with lookup...

    stan2004

      Hi reader !
      I have such problem:
      When I launch client, that lookup ejb object, on a remote machine (trying on Windows and Linux platform) i catch such Exception:
      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:558)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at RadioTaxi.application.StartWindow.EnterKeyActionPerformed(StartWindow.java:306)
      at RadioTaxi.application.StartWindow.access$100(StartWindow.java:37)
      at RadioTaxi.application.StartWindow$3.actionPerformed(StartWindow.java:180)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
      at javax.swing.plaf.basic.BasicButtonListener$ReleasedAction.actionPerformed(BasicButtonListener.java:301)
      at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1530)
      at javax.swing.JComponent.processKeyBinding(JComponent.java:2438)
      at javax.swing.JComponent.processKeyBindings(JComponent.java:2473)
      at javax.swing.JComponent.processKeyEvent(JComponent.java:2401)
      at java.awt.Component.processEvent(Component.java:4909)
      at java.awt.Container.processEvent(Container.java:1569)
      at java.awt.Component.dispatchEventImpl(Component.java:3615)
      at java.awt.Container.dispatchEventImpl(Container.java:1627)
      at java.awt.Component.dispatchEvent(Component.java:3477)
      at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713)
      at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:627)
      at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:831)
      at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:741)
      at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:592)
      at java.awt.Component.dispatchEventImpl(Component.java:3506)
      at java.awt.Container.dispatchEventImpl(Container.java:1627)
      at java.awt.Window.dispatchEventImpl(Window.java:1606)
      at java.awt.Component.dispatchEvent(Component.java:3477)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

      ..... But when I launch client on the same computer (localy) where jboss live all working excellent !

      P.S: On remote client I lookup ejb on server:
      192.168.20.3 - server
      192.168.20.6 - remote client --------- ejb lookup's on 192.168.20.3


      Thanks.

        • 1. Re: Problem with lookup...
          kabirkhan

          Set the java.naming.provider.url in the jndi.properties file you are using on your client, e.g.

          ### JBossNS properties
          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.provider.url=jnp://192.168.20.3:1099
          java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

          • 2. Re: Problem with lookup...
            stan2004

            properties already set to this:
            env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

            env.put("java.naming.provider.url",
            "jnp://192.168.20.3:1099");

            env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

            As I have already say: the same code work when server and client running on one computer and (without editing the code) don't work when running client on remote machine.

            • 3. Re: Problem with lookup...
              lepe

              Do you have more than one jndi.properties on the client? Does not seem to be the one you change that is used... Is it in the clients classpath?

              It do try to connect to 127.0.0.1 and that will only work when running client and server on same machine (of course).

              /L

              • 4. Re: Problem with lookup...
                stan2004

                I don't use jndi.properties file, I set properties in code.
                My client is in a jar file, so it's used classpath defined in _MANIFEST_ file (there is only jars that neseccary for client launch)

                • 5. Re: Problem with lookup...
                  stan2004

                  I don't use jndi.properties file, I set properties in code.
                  My client is in a jar file, so it's used classpath defined in _MANIFEST_ file (there is only jars that neseccary for client launch)
                  Have any ideas ?

                  • 6. Re: Problem with lookup...
                    raja05

                    can you ping ur server from client? Check if xhosts is enabled or try adding an entry in /etc/hosts