Version 2

    1) JBoss 4.2.3 deployed on a separate IP/process/machine (lets assume its deployed on IP

    2) JBoss 4.2.3 has a @Stateless bean deployed in an enterprise application "app".

    3) This bean implements @Remote interface which contains a method public String theMethod( String arg ).

    4) The service/bean gets a binding with name "app/TheServiceImpl/remote" inside JBoss 4.2.3


    How to call the theMethod() remote method from a JBoss 7.2 ?


    1) JBoss 7.2 must have a module defined as follows:

    - create dir JBOSS_HOME/modules/org/jboss/client/legacy/main

    - put the following module.xml file into that directory:

    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.1" name="org.jboss.client.legacy">
            <resource-root path="jbossall-client.jar" />
            <resource-root path="theLegacy.jar" />
            <module name="javax.api" />


    - copy to that folder as well jbossall-client.jar file from the JBOSS_4_2_3_HOME/client directory

    - jar theLegacy.jar must contain the and the class that makes the remote call (see 2)


    2) The class is created and added to the theLegacy.jar file as follows:


    public class LegacyProxy {
         public static String callTheMethod( String arg ) {
              try {
                   final Hashtable environment = new Hashtable();
                   environment.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
                   environment.put( javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
                   environment.put( javax.naming.Context.PROVIDER_URL, "jnp://" ); // remote machine IP
                   final javax.naming.InitialContext context = new javax.naming.InitialContext( environment );
          remoteO = ( context.lookup( "app/TheServiceImpl/remote" ); // ejb-name
                   return remoteO.theMethod( arg );
              } catch ( NamingException e ) {
                   throw new RuntimeException( "Failed to lookup remote ejb", e );


    3) Now in the application that needs the remote method to be called we need to declare the org.jboss.client.legacy module dependency inside jboss-deployment-structure.xml file as follows:


              <module name="org.jboss.client.legacy" />

    (Of course the same can be achieved by adding "Dependencies: com.ek.legacy" to the MANIFEST.MF file in deployment)


    4) Now inside the above application it shall be possible to call "x" ) without any problems.