I have two Jboss 7.1 final instances running on different hosts.
I try to invoke a service in one host from another host, as shown below:
try {
final Hashtable<String, String> props = new Hashtable<String, String>();
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
// create the InitialContext
final Context context = new javax.naming.InitialContext(props);
CService=(CServiceEJBRemote)context.lookup("ejb:......//(rute)ServiceEJBBean!(rute) ...ServiceEJBRemote");
// invoke on the bean
final boolean resp = CService.verificarUsuario(//some parameters...);
System.out.println("Received greeting: " + resp);
} catch (Exception e) {
throw new RuntimeException(e);
}
My EJB is packed in a EAR, and the Webclient is packaged as a WAR. I have placed the "jboss-ejb-client.xml" inside the EAR ( under WEB-INF/classes directory).
When " CService.verificarUsuario(//some parameters...);" is invoked , I get an exception:
No EJB receiver available for handling [appName:global,modulename:pinter,distinctname:pinter-ejb] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1fde5aa
JBoss AS7 is secured...meaning, you cannot just connect to it remotely. You must setup security correctly. This document details it pretty nicely, EJB Invocations from a Remote Server Instance .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.