5 Replies Latest reply on Feb 15, 2006 5:03 AM by Jan Philipp Giel

    JBoss- or Java-Configuration Error?

    Frank Lemke Newbie

      Hi,

      I use JBoss 4.0.1sp1. I wrote a server-application that is deployed, and a (rich-) client-application, which fetches remote-references of a bean.

      Running both applications (from within eclipse) on the same machine works well. The client connects to the server and retrieves the references. Putting the client on another machine, gives some Exceptions. First I checked out the network-traffic by using tcpdump. There are packages travelling in both directions between these machines, and the ports are as aspected (1099 is the destination-port of the first package, ...), as you can see here...


      13:57:54.190300 IP 192.168.1.11.1272 > 192.168.1.1.1099: S 1478068905:1478068905(0) win 65535 <mss 1460,nop,nop,sackOK>
      13:57:54.190358 IP 192.168.1.1.1099 > 192.168.1.11.1272: S 2611156208:2611156208(0) ack 1478068906 win 5840 <mss 1460,nop,nop,sackOK>
      13:57:54.190510 IP 192.168.1.11.1272 > 192.168.1.1.1099: . ack 1 win 65535
      13:57:54.192218 IP 192.168.1.1.1099 > 192.168.1.11.1272: P 1:5(4) ack 1 win 5840
      13:57:54.192745 IP 192.168.1.1.1099 > 192.168.1.11.1272: FP 5:353(348) ack 1 win 5840
      13:57:54.192977 IP 192.168.1.11.1272 > 192.168.1.1.1099: . ack 354 win 65183
      13:57:54.354133 IP 192.168.1.11.1272 > 192.168.1.1.1099: F 1:1(0) ack 354 win 65183
      13:57:54.354163 IP 192.168.1.1.1099 > 192.168.1.11.1272: . ack 2 win 5840


      The client throws this Exception:


      own address=FILIPENDULA/192.168.1.11
      Server-URL=jnp://192.168.1.1:1099
      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: connect]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:663)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at Test.main(Test.java:86)
      Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; 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:544)
      ... 3 more
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.<init>(Socket.java:309)
      at java.net.Socket.<init>(Socket.java:124)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
      ... 8 more
      Exception in thread "main"


      First 2 lines indicate, that java works with the correct IPs. I added that as suggested in the sticky-thread of this forum.

      Here is now the code of the client:

       /**
       * Contains the information needed to connect to
       * sessionbeans on the server.
       */
       public static Hashtable environment;
      
       /**
       * Call this method, if the game-server is NOT running locally.
       * This method initializes the context needed to access the
       * session-beans on the server.
       */
       public static void setEnvForRemoteConnection(String serverUrl) {
       if (serverUrl==null) throw new NullPointerException("Need serverUrl for remote connections!");
       environment = new Hashtable();
       environment.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       environment.put("java.naming.provider.url", serverUrl);
       environment.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       }
      
       public static void main(String[] args) throws Exception {
       String url = args[0];
       setEnvForRemoteConnection(url);
       Context initial = new javax.naming.InitialContext(environment);
       Object objref = initial.lookup("ejb/LoginEcho");
       }
      


      Why is he trying to connect to host: 127.0.0.1 ?

      The client is running on a WinXP-Machine, the server on a gentoo-linux-box. I copied the server from the gentoo-machine to the xp-machine, and tried to make XP be the server and Gentoo be the remote client (exchange roles). In that way, the communication works properly.

      But now restarting the client on the xp-box and trying to connect to the server on the gentoo-box, the error changes, if the jboss-server is still running on the xp-machine:


      javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:663)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at Test.main(Test.java:84)
      Caused by: java.rmi.NoSuchObjectException: no such object in table
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
      ... 3 more


      I am sure that there is no firewall active. Is the cause, why the XP-box tries to connect to 127.0.0.1, that the java-system is not configured correctly on that box? If yes, which parameters may be the reason? Or am I completly wrong with my ideas? Thanks for any helpful hint!

      Regards,
      Dumledore