4 Replies Latest reply on Feb 1, 2013 6:20 AM by sanssan Branched to a new discussion.

    JBoss 7.1.1.Final - EJB Remote Call - java.lang.IllegalStateException: No EJB receiver available for handling

    sanssan

      Hi,  I do have 2 JBoss stanalon instance running. 1 act as Server and another 1 would client.

       

      SERVER:

       

      Remote Interface

      package com.xyz.life.service.ejb;
      
      import java.io.Serializable;
      import java.rmi.RemoteException;
      
      import javax.ejb.EJB;
      import javax.ejb.Remote;
      
      @Remote
      public interface QuoteFacade extends Serializable{
      
          public boolean isAlive()    throws RemoteException;
      }
      

       

      EJB Impl

       

      package com.xyz.life.common.component.ejb.services;
      
      import java.rmi.RemoteException;
      
      import javax.ejb.Remote;
      import javax.ejb.Stateless;
      
      @Stateless(mappedName = "QuoteFacadeEJB")
      @Remote(QuoteFacade.class)
      public class QuoteFacadeEJB extends CommonSessionBean implements QuoteFacade {
      
          private static final long serialVersionUID = -8788783322280644881L;
      
          @Override
          public boolean isAlive() throws RemoteException {
              return true;
          }
      }
      

       

      server.log

       

      16:40:25,012 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named QuoteFacadeEJB in deployment unit subdeployment "quote.jar" of deployment "q
      uote.ear" are as follows:
      
              java:global/quote/quote.jar/QuoteFacadeEJB!com.xyz.life.service.ejb.QuoteFacade
              java:app/quote.jar/QuoteFacadeEJB!com.xyz.life.service.ejb.QuoteFacade
              java:module/QuoteFacadeEJB!com.xyz.life.service.ejb.QuoteFacade
              java:jboss/exported/quote/quote.jar/QuoteFacadeEJB!com.xyz.life.service.ejb.QuoteFacade
              java:global/quote/quote.jar/QuoteFacadeEJB
              java:app/quote.jar/QuoteFacadeEJB
              java:module/QuoteFacadeEJB
      

       

       

      Client

       

       

      public void testClient() {
              try {
                  Hashtable<String, Object> jndiProps = new Hashtable<String, Object>();
                  jndiProps.put(Context.URL_PKG_PREFIXES, JNDINames.JBOSS_CLIENT_NAMING_PREFIX);
                  jndiProps.put("jboss.naming.client.ejb.context", true);
                  Context ctx = new InitialContext(jndiProps);
                  
                  String name = "ejb:global/quote/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade";
                  /*
                  "ejb:global/quote/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                  "ejb:app/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                  "ejb:jboss/exported/quote/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade"
                  */
                  
                  Object ref = ctx.lookup(name);
                  
                  QuoteFacade quoteFacade = (QuoteFacade) ref;
                  LOGGER.debug("isAlive : " + quoteFacade.isAlive());
                  
              } catch (Exception e) {
                  LOGGER.error("Remote Client Exception : ", e);
              }
          }
      

       

       

      endpoint.name=client-endpoint
      remote.connections=default
      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
      remote.connection.default.host=localhost
      remote.connection.default.port = 4447
      remote.connection.default.username=admin
      remote.connection.default.password=Pass1234
      

      No error/log on server side. Client side, it is failing with following error:

       

      java.lang.IllegalStateException: No EJB receiver available for handling [appName:global,modulename:quote,distinctname:quote.jar] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@200cae
          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)
          at $Proxy10.isAlive(Unknown Source)
      
        • 1. Re: JBoss 7.1.1.Final - EJB Remote Call - java.lang.IllegalStateException: No EJB receiver available for handling
          sanssan

          I tried without using properties file:

           

          private static QuoteFacade connectToStatelessBean(String name) throws NamingException {
                  Properties jndiProperties = new Properties();
                  jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                  jndiProperties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
                  jndiProperties.put(javax.naming.Context.PROVIDER_URL, "remote://localhost:4447");
                  jndiProperties.put(javax.naming.Context.SECURITY_PRINCIPAL, "admin");
                  jndiProperties.put(javax.naming.Context.SECURITY_CREDENTIALS, "Pass1234");
                  final Context context = new InitialContext(jndiProperties);
          
                  return (QuoteFacade) context.lookup(name);
              }
              public static void testLocal() {
                  String[] JNDINAME1 = {
          
                      "ejb:global/quote/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                      "ejb:app/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                      "ejb:module/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                      "ejb:jboss/exported/quote/quote.jar/QuoteFacadeEJB!com.ge.life.annuity.service.ejb.QuoteFacade",
                      "ejb:global/quote/quote.jar/QuoteFacadeEJB",
                      "ejb:app/quote.jar/QuoteFacadeEJB",
                      "ejb:module/QuoteFacadeEJB"
                  };
                  for(int i=0;i<JNDINAME1.length;i++){
                      try {
                          QuoteFacade test1 = connectToStatelessBean(JNDINAME1[i]);
                          LOGGER.error("DSLKAJDLAS : " + test1.isAlive());
                      } catch (Exception e) {
                          LOGGER.error("DSLKAJDLAS : " , e);
                      }
          
                  }
                  LOGGER.info("Done - SANSSAN!!!!!!!!");
              }
          

           

          Got the following Exception(s) :

           

          14.01.2013 17:40:37.627 [ERROR] - EJBClient - DSLKAJDLAS : 
          javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "deployment.quote.war:main" from Service Module Loader
              at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
              at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
              at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
              at javax.naming.InitialContext.init(InitialContext.java:242)
              at javax.naming.InitialContext.<init>(InitialContext.java:216)
              at com.xyz.life.test.EJBClient.connectToStatelessBean(EJBClient.java:208)
              at com.xyz.life.test.EJBClient.testLocal(EJBClient.java:225)  
              at com.xyz.life.common.web.struts.plugin.FrameworkStartupPlugIn.init(FrameworkStartupPlugIn.java:99)
              at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
              at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
              at javax.servlet.GenericServlet.init(GenericServlet.java:242)
              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)
              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)
              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655)
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873)
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
              at java.lang.Thread.run(Thread.java:722)
          

           

          • 2. Re: JBoss 7.1.1.Final - EJB Remote Call - java.lang.IllegalStateException: No EJB receiver available for handling
            jaikiran

            You have got the JNDI name wrong. ejb:global/... ejb:app/... ejb:module/... isn't right. Based on those logs what you are looking for is:

             

            ejb:quote/quote.jar//QuoteFacadeEJB!com.xyz.life.service.ejb.QuoteFacade

             

            Read this for more details https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

            • 3. Re: JBoss 7.1.1.Final - EJB Remote Call - java.lang.IllegalStateException: No EJB receiver available for handling
              sanssan

              Excellent. Thanks Jai.  It worked like a good. That tutorial is very good. Help me to understand better.  If you find time, could you please help me on an issue with Logging (Log4j for EAR file application) - https://community.jboss.org/thread/219871  Thanks Again.

              • 4. Re: JBoss 7.1.1.Final - EJB Remote Call - java.lang.IllegalStateException: No EJB receiver available for handling
                sanssan

                Anybody have any thoughts? A small Help would be highly appreciated!!!