How to bind a ip address in Spring rmi settings?
How to bind a ip address in spring rmi settings? Instead of listen all IP in Server.
Currently I am using:
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="TestRmiService" />
<property name="service" ref="testRmiServiceBean" />
<property name="serviceInterface"
value="org.test.TestRmiService" />
<!-- defaults to 1099 -->
<property name="registryPort" value="1099" />
<!-- <property name="registryHost" v开发者_Go百科alue="127.0.0.1" /> this not working -->
</bean>
I am not sure but its not possbile to bind RMI just giving registryHost. You have two alternative to bind your custom IP.
First one is write your own implementation of RMIServerSocketFactory
or just pass -Djava.rmi.server.hostname
=Your.Ip.Address as a parameter.
For the details just review the source code of RmiServiceExporter and the Java Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4880793
精彩评论