4 Replies Latest reply on Jul 4, 2007 1:11 AM by Malert Jones

    java.rmi.ConnectException

    dominique boeckli Newbie

      Following Failes when Client and Server are different Domains:

       public IPmonHistorySupplier( String host, int port ) throws ServiceNotAvailableException {
       try {
       ServiceLocator serviceLocator = ServiceLocator.getInstance(host, port);
      
       System.out.println( new Date().toString() + " - getting home" );
       HistorySessionHome historyHome = ( HistorySessionHome )serviceLocator.getRemoteHome("HistorySession", HistorySessionHome.class);
       System.out.println( new Date().toString() + " - got home" );
      
       System.out.println( new Date().toString() + " - getting session" );
       historySession = historyHome.create();
       System.out.println( new Date().toString() + " - got session" );
      
       qcf = serviceLocator.getQueueConnectionFactory("ConnectionFactory");
       abortQueue = serviceLocator.getQueue("queue/IPmonGetHistoryAbortQueue");
      
       this.host = host;
       this.port = port;
       }
       /* Translate exceptions into ServiceNotAvailableException */
       catch (CreateException ex) {
       System.out.println( new Date().toString() + " - CreateException" );
       ex.printStackTrace();
       throw new ServiceNotAvailableException(ex);
       }
       catch (RemoteException ex) {
       System.out.println( new Date().toString() + " - RemoteException" );
       ex.printStackTrace();
       throw new ServiceNotAvailableException(ex);
       }
       catch (ServiceLocatorException ex) {
       System.out.println( new Date().toString() + " - ServiceLocatorException" );
       ex.printStackTrace();
       throw new ServiceNotAvailableException(ex);
       }
       catch (Exception ex) {
       System.out.println( new Date().toString() + " - Exception" );
       ex.printStackTrace();
       throw new ServiceNotAvailableException(ex);
       }
       }
      


      the Home lookup works fine but the session request failes after exactly 3 min and 30 seconds. Strange is also that the home lookup needs 21 seconds.
      Last Friday at 5 o'clock in the evening, when nearly everybody went home and the network had less traffic i was able to get a response from the session request.

      Fri Apr 29 13:08:33 CEST 2005 - getting home
      Fri Apr 29 13:08:54 CEST 2005 - got home
      Fri Apr 29 13:08:54 CEST 2005 - getting session
      Fri Apr 29 13:12:24 CEST 2005 - RemoteException
      java.rmi.ConnectException: Connection refused to host: 195.160.9.35; nested exception is:
       java.net.ConnectException: Connection timed out: 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.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
       at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:163)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:103)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
       at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
       at $Proxy0.create(Unknown Source)
       at ch.eds.ipmonitor.server.client.IPmonHistorySupplier.<init>(IPmonHistorySupplier.java:66)
       at ch.eds.ipmonitor.client.history.HistoryFrame.<init>(HistoryFrame.java:177)
       at ch.eds.ipmonitor.client.controller.IPmonitorController.run(IPmonitorController.java:597)
       at java.lang.Thread.run(Thread.java:534)
      Caused by: java.net.ConnectException: Connection timed out: 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)
       ... 16 more
      


      any idea what could be the cause of the problem ?

      many thanks for any help.