0 Replies Latest reply on Oct 5, 2012 6:30 AM by kjbalaji123 Branched from an earlier discussion.

    Invoking EJB from across servers

    kjbalaji123

      Hi Jaikiran,

       

       

      This is balaji and trying out the same scenario in Jboss 4.0.2 . Its looking up the Server A to B but when i am trying to call Server B method its thorws the null pointer exception.

       

      I have used below code for your references,

       

      Properties p = new Properties();       

              p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

             // p.put(Context.PROVIDER_URL, "jnp://" +IP+":"+jnp);

              p.put(Context.PROVIDER_URL,  IP+":"+jnp);

              System.out.println("Context.PROVIDER_URL---------->" +Context.PROVIDER_URL);

              p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

              return new InitialContext(p);

       

       

       

        String ip ="XXX.XX.XX.XXX";

                  String port="1099";

                  javax.naming.Context c =getInitialContext(ip,port);   // this method refers below code.

      System.out.println("test call");

              

                 Object remote = c.lookup("TestBean");

          

                  TestRemoteHome rv = (  TestBeanRemoteHome) PortableRemoteObject.narrow(remote,   TestRemoteHome.class);

                  return rv.create();

              } catch (NamingException

       

       

      above code running looking fine, after i calls the connection method to call

       

       

                   System.out.println("Jboss calling test ");

                   System.out.println("inputmap values ----->"+sm.getParameter("input"));  // throwing error for null exception

                

                  Object obj=rem.syncTest((HashMap)sm.getParameter("input")); // when i try to print "rem" object, it has null.

       

       

       

      Kindly, help me and advance thanks to u

       

       

      Thanks,

       

      Balaji KJ