No EJB listener to handle [appName :, moduleName: jmschat, distinctName:] when calling bean method

I can find the remote interface successfully, but when I call the method of this bean it gives the following error:

Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:jmschat, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@413157
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:727)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
at com.sun.proxy.$Proxy0.sendMessage(Unknown Source)
at Client.main(Client.java:64)

      

My client code:

    public static void main(String[] args) {

    Properties jndiProperties=new Properties();

    jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
    jndiProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");
    jndiProperties.put("jboss.naming.client.ejb.context", true);
    jndiProperties.put(Context.SECURITY_PRINCIPAL, "admin");
    jndiProperties.put(Context.SECURITY_CREDENTIALS, "********");
    jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
    //jndiProperties.put("jboss.naming.client.ejb.context", true);

    InitialContext ctx = null;

    try {

        ctx = new InitialContext(jndiProperties);

    } catch (NamingException e) {

        e.printStackTrace();

    }


    MessageProducerLocal messageProducerRemote= null;
    try {
       // assert ctx != null;
        String appName="";
        String moduleName="jmschat";
        String distinctName="";
        String beanName=MessageProducer.class.getSimpleName();
        String viewClassName=MessageProducerLocal.class.getName();
        //messageProducerLocal = (MessageProducerRemote) ctx.lookup("ejb:module/jmschat/MessageProducer!demo.jms.MessageProducerRemote");
        messageProducerRemote = (MessageProducerLocal) ctx.lookup("ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName);
    } catch (NamingException e) {
        e.printStackTrace(); 
    }

    messageProducerRemote.sendMessage("hello...this is msg");
 }

      

The line that gives me the error:

messageProducerRemote.sendMessage("hello...this is msg");

      

I am using EJB 3.1 and jboss EAP 6.1. I am new to both.

I was looking for this problem. But everywhere I found out it was related to search.

Any help and suggestion is greatly appreciated. Thanks and Regards

+3


source to share





All Articles