I am trying to connect to a remote RMI service exported as
<bean class="org.springframework.remoting.rmi.RmiService Exporter">
<property name="serviceName" value="Service"/>
<property name="service" ref="service"/>
<property name="serviceInterface" value="no.lyse.tele.transit.app.remote.service.Ser vice"/>
<property name="registryPort" value="1199"/>
</bean>

The kcient application is on another host. And is configured like this.
<bean id="testService" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
<property name="serviceUrl" value="rmi://192.168.21.45:1199/Service"/>
<property name="serviceInterface" value="no.lyse.tele.transit.app.remote.service.Ser vice"/>
</bean>

When i tested this service on the same host ( not via localhost ) it worked fine. But when they are are on different servers i get this strange exception.

DEBUG Thread-2 org.springframework.remoting.rmi.RmiClientIntercep torUtils - Remote service [rmi://192.168.21.45:1199/Service] threw exception
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:574)
at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:9 4)
at org.springframework.remoting.rmi.RmiInvocationWrap per_Stub.invoke(Unknown Source)
at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:347)
at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:294)
at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:209)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :170)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy0.executeAction(Unknown Source)

Were does the 127.0.0.1 come from. As you see i am trying to access a server on the network.