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

来源:互联网 发布:java.util.date jar包 编辑:程序博客网 时间:2024/06/10 00:43

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.

 
原创粉丝点击