2 Replies Latest reply on Feb 19, 2009 6:19 AM by anupkg4jboss

    EJB Client hangs while performing context lookup

    grim81

      Hello,

      im using jboss 3.2.5 on suse 9.1 and successfully deployed several cmp entity beans and one session bean on the server. now im trying to get a test client running. but when im looking up the ejb (doesnt matter what kind of ejb) the lookup hangs indefinetily without producing any kind of error. i used ethereal to watch network traffic and the client is starting to communicate with port 1099 but after a few packets the server sends FIN,ACK but the client is still doing nothing.

      thats the code i used in the client (partial of it):

      public void initialize() {
      long startTime = 0;
      if (logging) {
      log("Initializing bean access.");
      startTime = System.currentTimeMillis();
      }

      try {
      //get naming context
      Context context = getInitialContext();

      //look up jndi name
      Object ref = context.lookup("CostcenterRemote");
      //look up jndi name and cast to Home interface
      costcenterRemoteHome = (CostcenterRemoteHome) PortableRemoteObject.narrow(ref, CostcenterRemoteHome.class);
      if (logging) {
      long endTime = System.currentTimeMillis();
      log("Succeeded initializing bean access through Home interface.");
      log("Execution time: " + (endTime - startTime) + " ms.");
      }
      }
      catch(Exception e) {
      if (logging) {
      log("Failed initializing bean access.");
      }
      e.printStackTrace();
      }
      }

      private Context getInitialContext() throws NamingException {
      Hashtable environment = new Hashtable();

      environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      environment.put(Context.PROVIDER_URL, "jnp://localhost:1099");

      return new InitialContext(environment);
      }