JBoss RMI 远程调用需要注意的几个问题!

创建并部署了一个名为atestapp的应用,该应用包含EJB3组件。通过配置JBoss 4.0.4 RC1实例成功实现了远程访问。具体配置包括修改run.bat文件中的JAVA_OPTS参数以指定外部IP地址,并调整了jboss-service.xml文件中的remotingConnector配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Created a test app (which is attached) and deployed the ebj3 beans as ejb_app.ejb3 on a jboss-4.0.4RC1 instance (with ejb3 installed via gui installer). Made the following config changes:

run.bat - included the following:

set JAVA_OPTS=-Djava.rmi.server.hostname="24.99.54.78" -Djava.rmi.server.uselocalHostname=false %JAVA_OPTS%

so that the rmi stub for jndi gets the external ip instead of using local one.

jboss-4.0.4RC1/server/default/deploy/ejb3.deployer/META-INF/jboss-service.xml - changed remoting Connector config to:

 

<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="InvokerLocator">socket://${jboss.bind.address}:3873</attribute> -->
    
<!-- <attribute name="Configuration">
        <handlers>
            <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
        </handlers>
    </attribute> 
-->
    
<attribute name="Configuration">
    
<!-- Using the following <invoker> element instead of the InvokerLocator above because specific attributes needed. -->
    
<!-- If wanted to use any of the parameters below, can just add them as parameters to the url above if wanted use the InvokerLocator attribute. -->
    
<config>
        
<!-- Other than transport type and handler, none of these configurations are required (will just use defaults). -->
        
<invoker transport="socket">
            
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
            
<attribute name="serverBindPort">3873</attribute>
            
<attribute name="clientConnectAddress">24.99.54.78</attribute> 
            
<attribute name="clientConnectPort">3873</attribute>
        
</invoker>
        
<handlers>
            
<handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
        
</handlers>
    
</config>
    
</attribute>
</mbean>

 

Started jboss server using -b flag (i.e. run -b 192.168.1.104)

Then deploy ejb3 to server and run Client class.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值