JBoss7.1.1Final remote EJB Initiacontext issue
thinksteep Jun 10, 2013 5:52 PMHi Community,
I am having strange issue while creating "remote" intial context for EJB lookup.
I have standalone client (with multi threading). Each thread does lookup & call a method of EJB.
Skeleton code I have is:
public class EJBContextClient {
private static Context context;
public static void main(String[] args) throws NamingException {
if (context == null) {
createContext();
}
BeanRemote beanRemote = (BeanRemote) context.lookup("ejb:appName/ModuleName/BeamName!fullBeanPath");
long retVal = beanRemote.someMethod(somelongvalue);
}
private static void getContext() throws NamingException {
Properties props = new Properties();
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://remoteIP:4447");
props.put("jboss.naming.client.ejb.context", true);
props.put(Context.SECURITY_PRINCIPAL, "username");
props.put(Context.SECURITY_CREDENTIALS, "password");
context = new InitialContext(props);
}
}
As soon as new InitialContext(props); executed, I am seeing following entries in my client log: It is creating InitialContext for mylocal as well as remote machine (Not sure whether it is problem are not).
17:11:45,902 INFO XNIO Version 3.0.3.GA
17:11:45,926 INFO XNIO NIO Implementation Version 3.0.3.GA
17:11:45,975 INFO JBoss Remoting version 3.2.3.GA
17:11:46,600 INFO Received server version 1 and marshalling strategies [river]
17:11:46,646 INFO Successful version handshake completed for receiver context E
JBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@2226344d,
receiver=Remoting connection EJB receiver [connection=Remoting connection <36187
647>,channel=jboss.ejb,nodename=clientmachinename]} on channel Channel ID 9ff6a2ed (outbound
) of Remoting connection 1fa2fc5f to localhost/127.0.0.1:4447
17:11:46,647 WARN Unsupported message received with header 0xffffffff
17:11:46,661 INFO Received server version 1 and marshalling strategies [river]
17:11:46,663 INFO Successful version handshake completed for receiver context E
JBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@258167fd,
receiver=Remoting connection EJB receiver [connection=Remoting connection <32fdb
eda>,channel=jboss.ejb,nodename=remoteMachineName]} on channel Channel ID 9b9da375 (o
utbound) of Remoting connection 0ec1011b to /remoteIP:4447
17:11:46,664 WARN Unsupported message received with header 0xffffffff
----------------------------------------------------------------------
After this, one call to bean is succesful, but subsequent calls (second call onwards) are throwing follwoing error:
Caused by: java.lang.IllegalStateException: No EJB receiver available for handli
ng [appName:myAppName,modulename:myModuleName,distinctname:] combination for
invocation context org.jboss.ejb.client.EJBClientInvocationContext@6183d3b9
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(MyClientClassName.java:584)
MORE INFO ON ENVIRONMENT IS:
I have JBoss7.1.1Final and Standalone Client on Machine A
Machine B has JBoss 7.1.1Final and JMS/EJB application.
Standalone client on Machine A does lookup for JMS/EJB on Machine B
If client is on same machine (Machine B) as JMS/EJB. This is not an issue.
Any input would be really appreciated.
Thanks for your time and help.