0 Replies Latest reply on Nov 2, 2011 2:39 AM by Balaji Katika

    Accessing secure EJBs from remote server

    Balaji Katika Newbie

      Hi,

       

      I've been trying to invoke EJBs (secured) deployed on a remote server (say A) from my local EAR. Both EARs are deployed and running on JBoss 5.1

      To put it in simple words,... Access secured EJB from local EJB.

       

      Please help me get rid of this exception.. Also, suggest me alternate methods of invocation (like using org.jboss.naming.HttpNamingContextFactory).

       

      I've been getting the below exception

      Caused by: org.jboss.aop.NotFoundInDispatcherException: Object with oid: ProxyFactory/onaro/SummarySessionEJB/SummarySession was not found in the Dispatcher’

       

      Code snippet below...

       

      SummarySession ss = null;

      Properties env=new Properties();

      env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );

      env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" );

      env.setProperty("java.naming.provider.url", "10.10.10.1:1099"); // IP of the SS Server (Remote machine)

      env.put(Context.SECURITY_PRINCIPAL, "admin");

      env.put(Context.SECURITY_CREDENTIALS, "admin123");

       

      try {

        context = new InitialContext(env);

      } catch (NamingException e) {

      // TODO Auto-generated catch block

        e.printStackTrace();

      }

      System.out.println("Inititial context created");

       

      try {

      ss = (SummarySession) context.lookup(SummarySession.JNDI_NAME); //the JNDI binding on the remote server

      } catch (NamingException e) {

      e.printStackTrace();

      }

      String cbn = null;

      try {

      cbn = ss.getCodeBuildNumber();

      } catch (SummaryException e1) {

       

      e1.printStackTrace();

      }