Jboss behind a firewall

Jboss的EJB应用如果在防火墙后面,通过端口1098和1099调用,需要另外打开3873端口供socket调用,同时需要修改rmi-server地址为外部IP地址或域名。

配置文件一共需要修改四处,下面以域hnair.com内,防火墙后主机IP192.168.1.25为例,

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”
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”>hnair.com</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= hnair.com -Djava.rmi.server.useLocalHostname=false
Unix脚本例:添加到jboss启动配置文件run.conf中即可。

4.用run.sh –host=192.168.1.25启动服务或添加–host=192.168.1.25到启动脚本。

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.