Remote EJB calls
michaelhansenonecom Jun 12, 2019 5:44 AMI am currently in the process of upgrading a WF 13 -> WF 16 and Java 8 -> Java 11.
We have an environment with several WF servers talking remotely to each other using Apache CXF web services. When trying to upgrade to Java 11/WF16 that stopped working, as the WF version is <3.3.
I am now trying to rewrite our connection to use JNDI instead for remote calls, and that is working fine if I only calls remotely on a single server, but the moment I try to call EJB's on other WF servers I gets an error
(classnames, servers passwords changed):
Client:
private void testRemoteCall() {
Object remote = connectRemote("TestEJB", "test", TestRemote.class.getName());
if (remote != null) {
TestRemote testEJB = (TestRemote) remote;
String output = testEJB.getDate("input");
logger.info("Found: " + output);
} else {
logger.error("Could not find remote interface");
}
}
private Object connectRemote(String beanName, String appName, String viewClassName) {
try {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
final Context context = new InitialContext(jndiProperties);
final String moduleName = appName + "-ejb-impl";
final String distinctName = "";
String lookupUrl = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
logger.info(lookupUrl);
return context.lookup(lookupUrl);
} catch (Exception e) {
logger.error("Lookup error", e);
}
return null;
}
Error:
2019-06-12 09:19:33,412 ERROR Y5lO8vX7 1 mih [default task-1] [TestRemoteCallServlet] Write error:
javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "test/test-ejb-impl/TestEJB", view is interface com.one.test.TestRemote, affinity is None
....
Suppressed: javax.security.sasl.SaslException: DIGEST-MD5: Server rejected authentication
Client WF standalone-full.xml:
<system-properties>
<property name="jboss.bind.address" value="0.0.0.0"/>
...
<security-realm name="crm">
<server-identities>
<secret value="ABCDEFG"/>
</server-identities>
</security-realm>
...
<subsystem xmlns="urn:jboss:domain:ejb3:5.0">
...
<remote connector-ref="http-remoting-connector" thread-pool-name="default">
<channel-creation-options>
<option name="READ_TIMEOUT" value="${prop.remoting-connector.read.timeout:20}" type="xnio"/>
<option name="MAX_OUTBOUND_MESSAGES" value="1234" type="remoting"/>
</channel-creation-options>
</remote>
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="http" port="${jboss.http.port:8080}"/>
...
<outbound-socket-binding name="server2" >
<remote-destination host="server2.test.one.com" port="8080"/>
</outbound-socket-binding>
...
Any idea of what I am doing wrong or missing?