1 Reply Latest reply on Oct 5, 2004 10:45 AM by peter neville

    Calling remote session bean from servlet on another server o

    peter neville Newbie

      I am trying to call a remote stateless session bean from another server within a servlet.

      In the servlet I have:

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory" );
      env.put(Context.PROVIDER_URL, "http://borg:8080/invoker/JNDIFactory");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

      InitialContext ic = new InitialContext(env);
      Object objref = ic.lookup("java:comp/env/ejb/remoteTest");
      Object obj = PortableRemoteObject.narrow(objref, RemoteEJBTestHome.class);
      RemoteEJBTestHome testHome = (RemoteEJBTestHome)obj;

      I have deployed the ear to both servers and when I call the servlet on one, the jndi lookup is successful.
      However, the bean executes in the ejb container of the local server rather than the remote one. This can be verified by the number of instances in the JMX console.

      How can I get the bean to execute on the remote server instead?