1 Reply Latest reply on May 28, 2004 4:12 PM by ironbird

    lookup problem...

    Vitaliy Novikov Newbie

      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



      The code in both cases are same.
      I don't use jndi.properties file - I fill Properties object in code:

      env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

      env.put("java.naming.provider.url",
      new String("jnp://" + server_host_name +":1099"));

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


      where server_host_name changed according placement of client program:
      if we running localy - it's means 127.0.0.1
      if we running client from remote machine - server_host_name = 192.168.20.3



      Have any ideas, where I wrong ? Thanks

        • 1. Re: lookup problem...
          ironbird Newbie

          Are you sure your server is accessible from your client machine. Don't you have a firewall between both ?

          I always use myself this code snippet and it works fine:

          Properties prop = new Properties();
          prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
          prop.put(Context.PROVIDER_URL, "jnp://<ServerName Here>:1099");
          prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
          Context context = new InitialContext(prop);
          
          Object ref = context.lookup(<bean JNDI name Here>);
          myBeanhome = (BeanHome) PortableRemoteObject.narrow(ref, BeanHome.class);