0 Replies Latest reply on Nov 5, 2013 5:27 AM by Dibyendu Sarkar

    No EJB Receiver Available to Handle

    Dibyendu Sarkar Newbie

      Hi All,

      I am very new to EJB3 and jboss.

      Below is the environment I am using.


      eclipse juno.

      jboss 7.1

      EJB 3.0


      Description :


      I have made an EJB project in which I have a simple stateless bean. I have another class in the same application which is acting as the client and trying to access the Bean remotely.


      Below are the codes:


      package com.ibytecode.businesslogic;


      Bean class:


      import com.ibytecode.business.HelloWorld;

      import javax.ejb.Stateless;



      public class HelloWorldBean implements HelloWorld {

          public HelloWorldBean() {



          public String sayHello() {

              return "Hello World !!!";




      Business Interface :


      package com.ibytecode.business;

      import javax.ejb.Remote;



      public interface HelloWorld {

          public String sayHello();



      EJB client code :


      package com.ibytecode.client;


      import javax.naming.Context;

      import javax.naming.NamingException;


      import com.ibytecode.business.HelloWorld;

      import com.ibytecode.businesslogic.HelloWorldBean;

      import com.ibytecode.clientutility.ClientUtility;


      public class EJBApplicationClient {


          public static void main(String[] args) {

              HelloWorld bean = doLookup();

              System.out.println(bean.sayHello()); // 4. Call business logic



          private static HelloWorld doLookup() {

              Context context = null;

              HelloWorld bean = null;

              try {

                  // 1. Obtaining Context

                  context = ClientUtility.getInitialContext();

                  // 2. Generate JNDI Lookup name

                  String lookupName = getLookupName();

                  // 3. Lookup and cast

                  bean = (HelloWorld) context.lookup(lookupName);


              } catch (NamingException e) {



              return bean;



          private static String getLookupName() {


      The app name is the EAR name of the deployed EJB without .ear suffix.

      Since we haven't deployed the application as a .ear,

      the app name for us will be an empty string


              String appName = "";


              /* The module name is the JAR name of the deployed EJB

              without the .jar suffix.


              String moduleName = "HelloWorldSessionBean";


      /*AS7 allows each deployment to have an (optional) distinct name.

      This can be an empty string if distinct name is not specified.


              String distinctName = "";


              // The EJB bean implementation class name

              String beanName = HelloWorldBean.class.getSimpleName();


              // Fully qualified remote interface name

              final String interfaceName = HelloWorld.class.getName();


              // Create a look up string name

              String name = "ejb:" + appName + "/" + moduleName + "/" +

                  distinctName    + "/" + beanName + "!" + interfaceName;


              return name;




      EJB client utility(I have created for convenience) :


      package com.ibytecode.clientutility;


      import java.util.Properties;

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NamingException;


      public class ClientUtility {


          private static Context initialContext;


          private static final String PKG_INTERFACES = "org.jboss.ejb.client.naming";


          public static Context getInitialContext() throws NamingException {

              if (initialContext == null) {

                  Properties properties = new Properties();

                  properties.put(Context.URL_PKG_PREFIXES, PKG_INTERFACES);

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

                  initialContext = new InitialContext(properties);


              return initialContext;











      remote.connection.default.port = 4447




      Exception stack:


      Nov 03, 2013 4:47:40 AM org.jboss.ejb.client.EJBClient <clinit>

      INFO: JBoss EJB Client version 1.0.5.Final

      Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:HelloWorldSessionBean,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@786bb78a

        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 $Proxy0.sayHello(Unknown Source)

        at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:14)


      JAR Added:


      I have added jboss-client.


      Please suggest what is missing or wrong.