6 Replies Latest reply on May 26, 2006 1:45 PM by jahlborn

    talking to remote jboss instance from within jboss

    jahlborn

      Hey,
      We are trying to get an EJB on one jboss instance to make a remote method call to an EJB on another jboss instance (version 4.0.3SP1). In both cases, the EJBs are clustered. The problem, however, is that all attempts to contact the "remote" EJB result in method calls to the local jboss instance. Initially, the caller had both applications running, so a "successful" call was made to the local application (not really successful because we are trying to call the remote service!). When we removed the local instance of the other application, then we would just get "service not found" exceptions. The code snippet involved is:

      public MetadataRepository getMetadataRepository(String otherUrl) throws CreateException, RemoteException, NamingException {
       Properties env = new Properties();
       env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       env.put(Context.PROVIDER_URL, otherUrl);
       Context ctx = new InitialContext(env);
       Object ref = ctx.lookup(com.hmsonline.scorpio.client.MetadataRepositoryHome.JNDI_NAME);
       return ((com.hmsonline.scorpio.client.MetadataRepositoryHome)PortableRemoteObject.narrow(ref, com.hmsonline.scorpio.client.MetadataRepositoryHome.class)).create();
       }
      


      I've poked around jira and the wiki and seen some references to past bugs which talk about "optimizations" of clustered method calls which end up making local calls, however all referenced bugs seem to be "fixed" (e.g. JBAS-1442). Any ideas on what i might be doing wrong?