0 Replies Latest reply on Aug 4, 2008 1:11 AM by Vardan Pathak

    Unable to access the EJB from client

    Vardan Pathak Newbie

      Unable to access the EJB deployed in JBoss from standalone client.
      due to this exception ----->javax.naming.CommunicationException: Operation failed [Root exception is java.rmi.ServerException: IOE; nested exception is:
      java.net.ProtocolException: Server redirected too many times (20)]

      Using this code to access the EJB running on JBoss.

      public class FirstEJB3TutorialClient {

      /**
      * @param args
      */
      public static void main(String[] args) {

      Properties systemSettings = System.getProperties();
      systemSettings.put("http.proxyHost", "sdcproxy1.canon.co.in");
      systemSettings.put("http.proxyPort", "80");
      System.setProperties(systemSettings);

      Properties prop = new Properties();prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
      prop.setProperty(Context.PROVIDER_URL, "http://10.8.4.149:8002/invoker/JNDIFactory");
      prop.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");


      Context context;
      Context nctx = null;
      try
      {
      Context ctx = new InitialContext(prop);

      nctx = new InitialContext();

      MasterSetUpRemoteHome home=null;

      home = (MasterSetUpRemoteHome)PortableRemoteObject.narrow(ctx.lookup("MasterSetUpBean"), Class.forName("MasterSetUpRemoteHome.class"));
      Masterlist master=(Masterlist) home.create();


      } catch (Exception e)
      {
      e.printStackTrace();
      throw new RuntimeException(e);
      }
      }
      }



      Wxception coming is :------>

      javax.naming.CommunicationException: Operation failed [Root exception is java.rmi.ServerException: IOE; nested exception is:
      java.net.ProtocolException: Server redirected too many times (20)]
      at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:65)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
      at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:53)
      Caused by: java.rmi.ServerException: IOE; nested exception is:
      java.net.ProtocolException: Server redirected too many times (20)
      at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:133)
      at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:241)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:181)
      at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:57)
      ... 8 more
      Caused by: java.net.ProtocolException: Server redirected too many times (20)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
      at org.jboss.invocation.http.interfaces.Util.invoke(Util.java:178)
      at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:118)
      ... 11 more