2 Replies Latest reply on Dec 10, 2002 10:12 AM by Marcus Brito

    Unable to lookup EJB's in remote client

    Marcus Brito Novice

      Hello folks,

      I'm unable to lookup a EJB in a remote (swing) client. It seems that the NamingContext insists in using the local address ( for lookups, despite the value of the java.naming.provider.url property. Here's what I'm doing:
      [pre]Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      props.put(Context.PROVIDER_URL, "jnp://");
      context = new InitialContext(props);

      // name and clazz are defined elsewhere
      return PortableRemoteObject.narrow(context.lookup(name), clazz);[/pre]
      However, this code fails with the following exception:
      Root exception is java.rmi.ConnectException: Connection refused to host:;
      nested exception is:

      java.net.ConnectException: Connection refused: connect
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:469)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:448)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at com.telebahiacelular.movistore.client.RemoteUtils.lookup(RemoteUtils.java:32)
      What could be wrong? Why it's using even when I've set the provider URL to a different address? By the way, this used to work fine when I run JBoss on the same machine. Now that I (finally) moved JBoss out of my development machine, I can't connect anymore.