如何在spring rmi设置中绑定(bind)IP地址?而不是监听Server中的所有IP。
目前我正在使用:
<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" value="127.0.0.1" /> this not working -->
</bean>
最佳答案
我不确定,但仅提供registryHost 是不可能绑定(bind)RMI 的。 您有两种选择来绑定(bind)您的自定义 IP。
第一个是编写您自己的 RMIServerSocketFactory
实现,或者只是传递 -Djava.rmi.server.hostname
=Your.Ip.Address 作为参数。
详细信息请查看 RmiServiceExporter 的源代码和 Java Bug:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4880793
关于java - 如何在Spring rmi设置中绑定(bind)IP地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4301222/