3 Replies Latest reply on Sep 10, 2012 9:35 AM by jaikiran

    JNDI Lookup is not working in thread's run method (AS 7.1)

    sandip.jorwekar

      My code is working properly when i don't use thread  ( It does JNDI lookup and return home stub and also and also create the remote object stub)

      But When i use Thread (run method) to do JNDI lookup, at that time JNDI lookup for home stub is successful but it fails when home.create() method is get called and it returns with below error

      java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:auroraclientcommon,distinctname:]

      my code snippet is as below and i get the error at Book xref1=bookHome.create();

      public void run() {
      // TODO Auto-generated method stub
      System.out.println("runnable");
      BookHome bookHome = null;
      try { bookHome = (BookHome) ctx.lookup("app/Book!test.BookHome"); }

      Book xref1=bookHome.create();
      System.out.println("run "+xref1);
      } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
      }

        • 1. Re: JNDI Lookup is not working in thread's run method (AS 7.1)
          jaikiran

          What does the JNDI context creation code look like? And please post the entire exception stacktrace. Which exact version of JBoss AS 7.1 is this?

          • 2. Re: JNDI Lookup is not working in thread's run method (AS 7.1)
            sandip.jorwekar

            The Jboss version is jboss-as-7.1.1.Final

             

            The code snippet is as below

                Properties prop = new Properties();

              prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

              prop.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");

              prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

              prop.put("jboss.naming.client.ejb.context", true);

              prop.put(Context.SECURITY_PRINCIPAL, "test");

              prop.put(Context.SECURITY_CREDENTIALS, "test");

              ctx = new InitialContext(prop);

             

             

            The error is

             

            1. java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:test,distinctname:] combination for invocation context org

            .jboss.ejb.client.EJBClientInvocationContext@87ad67

                    at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)

                    at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)

                    at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

                    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

                    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

                    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

            • 3. Re: JNDI Lookup is not working in thread's run method (AS 7.1)
              jaikiran