Search code examples
jbossejbjboss7.xejb-3.0jboss-4.2.x

Remoting JBoss AS 7 to AS 4 and vice versa


Is it possible to remotely access an EJB on a JBoss AS 4 from a JBoss AS 7 and vice versa (using EJB3)?

If so, how can I do it?

I am looking for any information about remoting between different JBoss Versions. There must be something on the web, but I'm struggling on finding the right search terms.


Solution

  • It's possible.

    You have to create the remote interface and the bean on JBoss A4.

    @javax.ejb.Remote
    public interface JBossFourRemote{
        int doSomething();
    }
    
    @javax.ejb.Stateless
    public JBossFourBean implements JBossFourRemote{
        public int doSomething(){
            return 1;
        }
    }
    

    Deploy that, and then call the bean from the JBoss AS 7 client as follows.

    public void someJBossSevenMethod(String args[]){
        JBossFourRemote bean = (JBossFourRemote)new InitialContext().lookup("java:global/app/module/JBossFourBean!JBossFourRemote");
        bean.doSomething();
    }