Hi all! I am currently working on a project were we are handling massive amounts of data. We are moving and manupulating data from one datasource to another. To do this we have create a couple of Java SE-applications that are run in a specified order. The whole process is managed by a Swing application which can handle multiple clients. The communication with the clients is handled by RMI using the RmiServiceExporter in Swing. The solution works perfectly for a couple of hours but then it crashes and gives the Exception below:

Code:
Exception in thread "AWT-EventQueue-0" org.springframework.remoting.RemoteLookup
FailureException: Lookup of RMI stub failed; nested exception is java.rmi.Connec
tException: Connection refused to host: gae1w1hd; nested exception is:
        java.net.ConnectException: Connection refused: connect
        at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:214)
        at org.springframework.remoting.rmi.RmiClientInterceptor.prepare(RmiClie
ntInterceptor.java:146)
        at org.springframework.remoting.rmi.RmiClientInterceptor.afterProperties
Set(RmiClientInterceptor.java:134)
        at org.springframework.remoting.rmi.RmiProxyFactoryBean.afterPropertiesS
et(RmiProxyFactoryBean.java:67)
        at se.lantmateriet.global.migration.gui.entity.BatchNode.getRemoteInterf
ace(BatchNode.java:144)
        at se.lantmateriet.global.migration.gui.entity.BatchNode.disconnect(Batc
hNode.java:238)
        at se.lantmateriet.global.migration.gui.entity.MigrationNode.disconnect(
MigrationNode.java:166)
        at se.lantmateriet.global.migration.gui.guielements.dataextraction.DataE
xtractionNodeListEditPanel.actionPerformed(DataExtractionNodeListEditPanel.java:
191)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
95)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:236)
        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574
)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)

        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.rmi.ConnectException: Connection refused to host: gae1w1hd; nest
ed exception is:
        java.net.ConnectException: Connection refused: connect
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198
)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Naming.java:84)
        at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:199)
        ... 32 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:525)
        at java.net.Socket.connect(Socket.java:475)
        at java.net.Socket.<init>(Socket.java:372)
        at java.net.Socket.<init>(Socket.java:186)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
SocketFactory.java:22)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.java:128)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
        ... 38 more
org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub fa
iled; nested exception is java.rmi.ConnectIOException: error during JRMP connect
ion establishment; nested exception is:
        java.net.SocketException: No buffer space available (maximum connections
 reached?): recv failed
        at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:214)
        at org.springframework.remoting.rmi.RmiClientInterceptor.refreshAndRetry
(RmiClientInterceptor.java:324)
        at org.springframework.remoting.rmi.RmiClientInterceptor.handleRemoteCon
nectFailure(RmiClientInterceptor.java:305)
        at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClien
tInterceptor.java:261)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy20.getReportedExceptions(Unknown Source)
        at se.lantmateriet.global.migration.gui.entity.DataExtractionNode.getRep
ortedExceptions(DataExtractionNode.java:297)
        at se.lantmateriet.global.migration.gui.entity.DataExtractionNode.update
(DataExtractionNode.java:242)
        at se.lantmateriet.global.migration.gui.entity.MigrationNode$HealthCheck
TimerTask.run(MigrationNode.java:285)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishme
nt; nested exception is:
        java.net.SocketException: No buffer space available (maximum connections
 reached?): recv failed
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286
)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Naming.java:84)
        at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiC
lientInterceptor.java:199)
        ... 11 more
Caused by: java.net.SocketException: No buffer space available (maximum connecti
ons reached?): recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
        at java.io.DataInputStream.readByte(DataInputStream.java:248)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:228
)
I have tried to monitor the applications using jvisualvm and tcpview to dry and detect any leaks but it all looks good. Does anyone have an idea on what could cause this error?

Cheers, Pontus