9 Replies Latest reply on Sep 6, 2013 5:16 AM by thiru123

    Jboss 7.2 issue with multiple invocation using same ejb reference

    sketcha

      Hi All,

      I am facing an issue with multiple invocation using same ejb refernce.

      If i pass the ejb refernce obtained by remote JNDI lookup to multiple threades and use it there for perofrming method invocation it is resulting in the below error

      java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling

       

      here is my code piece

       

                          final Hashtable<String, Object> jndiProperties = new Hashtable<String, Object>();

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

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

                          jndiProperties.put(Context.PROVIDER_URL,"remote://localhost:4447");

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

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

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

                          jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT","false");

                           final Context context = new InitialContext(jndiProperties);

                          UserInfo ui = (UserInfo) context.lookup("test/UserInfoBean!com.test.UserInfo");

                          System.out.println(ui.getUserId()); // works correctly         

                           

             class myclass  extends Thread{

                      UserInfo ui2;

                      myclass(UserInfo ui1){

                      ui2= ui1;

                      }

                      public void run(){

                      try {

                                     System.out.println(ui2.);

                            } catch (Exception

                                              e.printStackTrace();

                                                                         }

                    }

             }

                                              for (int i = 0; i < 3; i++) {

                                                        new myclass(ui).start();

                                              }