1.首先修改jboss-service.xml,在ejb端口1098附近,修改CallByValue值為true
<attribute name="CallByValue">true</attribute>
2.然后修改ejb3.deployer中jboss-service.xml文件,主要是添加域名到3873的調用中
<mbean code="org.jboss.remoting.transport.Connector"
xmbean-dd="org/jboss/remoting/transport/Connector.xml"
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
<depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="Configuration">
<config>
<invoker transport="socket">
<attribute name="numAcceptThreads">1</attribute>
<attribute name="maxPoolSize">300</attribute>
<attribute name="clientMaxPoolSize" isParam="true">50</attribute>
<attribute name="timeout" isParam="true">60000</attribute>
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
<attribute name="serverBindPort">3873</attribute>
<!-- that's the important setting -->
<attribute name="clientConnectAddress">10.104.46.119</attribute>
<attribute name="clientConnectPort">3873</attribute>
<attribute name="backlog">200</attribute>
</invoker>
<handlers>
<handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
</handlers>
</config>
</attribute>
</mbean>
3.設置java啟動選項,添加rmi-server的外部地址和禁用本地域名解析到啟動腳本
Windows腳本例:set JAVA_OPTS=-Djava.rmi.server.hostname= external IP -Djava.rmi.server.useLocalHostname=false
Unix腳本例:添加到jboss啟動配置文件run.conf中即可。
4.用run.sh --host=192.168.1.25啟動服務或添加--host=192.168.1.25到啟動腳本。
1.在使用Jboss 4.2GA 遇到的問題. 以下是以default 模式啟動的Jboss .啟動參數 -c default /all
(1). localhost可以訪問與本機IP不能訪問
解決方式:
修改JBOSS_HOME"server"default"deploy"jboss-web.deployer下的server.xml 將address改為0.0.0.0或者你的實際IP 重啟 JBOSS 然后就可以通過ip訪問。
(3)在windows 客戶端調用 Linux 服務端 遇到org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://127.0.0.1:3873/]
解決方法: 修改 JBOSS_HOME/server/default/deploy/ejb3.deployer/META-INF/jboss-services.xml 文件中的${jboss.bind.address}:3873 為linux_home_ip:3873
以上兩個問題也可以通過以下設置解決:
For Windows, use
run.bat -b 0.0.0.0
for Linux use
run.sh -b 0.0.0.0