JNDI JBoss error calling EJB - No EJB receiver available for handling

0

I have searched the net and old question and have no answer that solves my issue. Fresh install of JBoss 7 1.1 final, I am trying to call EJB using JNDI. It looks like it connects OK but has an error on actual method call.

Here is the Java JNDI code:

InitialContext context = null;
Hashtable env = new Hashtable();
String ejbUrl = TestEJBClient.calculateJbossEjbJndiName ( "TestEJB" , "" , "" , TestEJB.class.getSimpleName ( ) , TestEJBRemote.class.getName ( ) , false );
env.put("jboss.naming.client.ejb.context", true);
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
env.put(Context.SECURITY_PRINCIPAL, "jboss");
env.put(Context.SECURITY_CREDENTIALS, "jboss1");
context = new InitialContext(env);
TestEJBRemote ejbRemote = (TestEJBRemote) context.lookup(ejbUrl);
Customer rtn = ejbRemote.getCustomerByAccountNumber(accountNumber);

Here is the method to calculate the name:

public static String calculateJbossEjbJndiName(String appName , String moduleName , String distinctName , String beanName , String viewClassName, boolean stateful)
{
     String rtn = "ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName;
     if (stateful)
     {
          rtn = rtn + "?stateful";
     }
     return rtn;
}

Here is the log from run:

[DEBUG][org.jboss.naming.remote.client.InitialContextFactory][getOptionMapFromProperties][12:20:25:PM][jboss.naming.client.connect.options. has the following options {}]
[DEBUG][org.jboss.ejb.client.EJBClientPropertiesLoader][loadEJBClientProperties][12:20:26:PM][Looking for jboss-ejb-client.properties using classloader sun.misc.Launcher$AppClassLoader@35ce36]
[DEBUG][org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector][<init>][12:20:26:PM][EJB client context org.jboss.ejb.client.EJBClientContext@1543c88 will have no EJB receivers associated with it since there was no EJB client configuration available to create the receivers]
[DEBUG][org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver][handleDone][12:20:26:PM][Channel Channel ID 84a7a320 (outbound) of Remoting connection 00704baa to localhost/127.0.0.1:4447 opened for context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1592174, receiver=Remoting connection EJB receiver [connection=Remoting connection <1ccce3c>,channel=jboss.ejb,nodename=ny-go-oss2790a]} Waiting for version handshake message from server]
[INFO][org.jboss.ejb.client.remoting.VersionReceiver][handleMessage][12:20:26:PM][Received server version 1 and marshalling strategies [river]]
[INFO][org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver][associate][12:20:26:PM][Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1592174, receiver=Remoting connection EJB receiver [connection=Remoting connection <1ccce3c>,channel=jboss.ejb,nodename=ny-go-oss2790a]} on channel Channel ID 84a7a320 (outbound) of Remoting connection 00704baa to localhost/127.0.0.1:4447]
[DEBUG][org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver][modulesAvailable][12:20:26:PM][Received module availability report for 2 modules]
[DEBUG][org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver][modulesAvailable][12:20:26:PM][Registering module EJBModuleIdentifier{appName='TestEJB', moduleName='TestEJB', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1592174, receiver=Remoting connection EJB receiver [connection=Remoting connection <1ccce3c>,channel=jboss.ejb,nodename=ny-go-oss2790a]}]
[DEBUG][org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver][modulesAvailable][12:20:26:PM][Registering module EJBModuleIdentifier{appName='TestEJB', moduleName='TestWeb', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1592174, receiver=Remoting connection EJB receiver [connection=Remoting connection <1ccce3c>,channel=jboss.ejb,nodename=ny-go-oss2790a]}]
[WARN][org.jboss.ejb.client.remoting.ChannelAssociation][handleMessage][12:20:26:PM][Unsupported message received with header 0xffffffff]
ejbUrl = ejb:TestEJB///TestEJB!org.test.services.om.TestEJBRemote
[INFO][org.jboss.ejb.client][<clinit>][12:20:26:PM][JBoss EJB Client version 1.0.5.Final]
ejbRemote = Proxy for remote EJB StatelessEJBLocator{appName='TestEJB', moduleName='', distinctName='', beanName='TestEJB', view='interface org.test.services.om.TestEJBRemote'}
java.lang.IllegalStateException: No EJB receiver available for handling [appName:TestEJB,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@105d88a
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:TestEJB,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@105d88a
    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)
jboss
jboss7.x
jndi
ejb-3.0
asked on Stack Overflow Mar 12, 2013 by Nicholas Fitzroy • edited Jan 15, 2020 by TT.

2 Answers

0

Might be because of the jar files that were used in the client. Check this out : https://community.jboss.org/thread/227862

answered on Stack Overflow Jul 7, 2013 by Sriram
0

I found the solution, It is to add this line to my client code:

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

No EJB receiver available for handling

answered on Stack Overflow Jan 15, 2020 by Chami • edited Jan 15, 2020 by TT.

User contributions licensed under CC BY-SA 3.0