How to connect to JBoss EAP 7 using JBoss EAP 6 EJB / JMS / JNDI client
Environment
- Red Hat JBoss Enterprise Application Platform
- 7.x
- 6.4
Issue
- How to connect to JBoss EAP 7 using JBoss EAP 6 EJB / JMS / JNDI client?
- How can the JBoss EAP 7 remoting subsystem be configured so that a JBoss EAP 6.4 application can connect to it?
- Is there a "legacy" remoting connector or a way for EAP 6 to understand the new JBoss EAP 7 http-remoting protocol ?
Resolution
Adding the legacy remoting connector to EAP 7
These CLI commands will add the legacy remoting connect to the remoting subsystem on port 4447
/socket-binding-group=standard-sockets/socket-binding=legacy-remoting:add(port=4447)
/subsystem=remoting/connector=legacy-remoting-connector:add(socket-binding=legacy-remoting, security-realm=ApplicationRealm)
/subsystem=remoting/connector=legacy-remoting-connector/property=SSL_ENABLED:add(value=false)
Note: the SSL_ENABLED=false is added, because in EAP 7.1+ there is a self signed certificate in the example profile configuration that allows SSL to be enabled, and in EAP 6.4 it defaults to SSL_ENABLED=false, so setting SSL_ENABLED=false allows the example configuration in EAP 7.1 to continue to allow the https connector in the undertow subsystem to use the ApplicationRealm as well to allow the legacy remoting connector to use the same realm but with ssl not enabled.
The resulting profile xml is :
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
...
<connector name="legacy-remoting-connector" socket-binding="legacy-remoting" security-realm="ApplicationRealm">
<properties>
<property name="SSL_ENABLED" value="false"/>
</properties>
</connector>
...
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="legacy-remoting" port="4447"/>
...
Change the ejb3 remote service to use the legacy-remoting-connector
/subsystem=ejb3/service=remote:write-attribute(name=connector-ref,value=legacy-remoting-connector)
Resulting in:
<remote connector-ref="legacy-remoting-connector" thread-pool-name="default">
Having EJB use more than 1 connector
Note: Make sure you are using EAP 7.4 or later!
Configure the ejb3 remote service to use both http-remoting-connector and legacy-remoting-connector with this command below.
Note: using a connector not configured on the connectors for remote EJB calls can result in unexpected behavior.
/subsystem=ejb3/service=remote:write-attribute(name=connectors,value=[http-remoting-connector,legacy-remoting-connector])
This command results in this xml configuration:
<remote cluster="ejb" connectors="http-remoting-connector legacy-remoting-connector" thread-pool-name="default">
Adding the legacy messaging connector to EAP 7
- Create
remote-acceptorandremote-connectorusing thelegacy-messagingsocket binding undermessaging subsystem.
/socket-binding-group=standard-sockets/socket-binding=legacy-messaging:add(port=5445)
/subsystem=messaging-activemq/server=default/remote-acceptor=legacy-acceptor:add(socket-binding=legacy-messaging)
/subsystem=messaging-activemq/server=default/remote-connector=legacy-connector:add(socket-binding=legacy-messaging)
- Configure
legacy-connection-factoryusing aboveremote-connector.
/subsystem=messaging-activemq/server=default/legacy-connection-factory=LegacyRemoteConnectionFactory:add(connectors=[legacy-connector], entries=[java:jboss/exported/legacy/jms/RemoteConnectionFactory])
- Configure
legacy-entriesfor the queue JNDI
/subsystem=messaging-activemq/server=default/jms-queue=testQueue:add(entries=[java:/jms/queue/testQueue, java:jboss/exported/jms/queue/testQueue], legacy-entries=[java:jboss/exported/legacy/jms/queue/testQueue])
The resulting profile xml looks like this:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
...
<remote-connector name="legacy-connector" socket-binding="legacy-messaging"/>
...
<remote-acceptor name="legacy-acceptor" socket-binding="legacy-messaging"/>
...
<legacy-connection-factory name="LegacyRemoteConnectionFactory" entries="java:jboss/exported/legacy/jms/RemoteConnectionFactory" connectors="legacy-connector"/>
...
<jms-queue name="testQueue" entries="java:/jms/queue/testQueue java:jboss/exported/jms/queue/testQueue" legacy-entries="java:jboss/exported/legacy/jms/queue/testQueue"/>
...
</subsystem>
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="legacy-messaging" port="5445"/>
...
</socket-binding-group>
Client JNDI configuration
The JNDI / EJB / JMS client side code in JBoss EAP 6.4 client calling EAP 7 would be the same which would be:
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
env.put("jboss.naming.client.remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
env.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS", "false");
Related Solutions
- How to configure an EJB client in JBoss EAP 6 / 7.0
- How configure an EJB client in EAP 7.1
- Alternatively, IIOP can be used between EAP 6 and 7 for EJB calls: How to expose an EJB via IIOP and call it in JBoss EAP 7 / 6
Root Cause
Having EJB subsystem with more than one connector is a EAP 7.4+ feature.
Diagnostic Steps
- Using two connectors on EJB subsystem in EAP 7.3- (versions previous to EAP 7.4) will result in:
16:18:55,237 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "ejb3"),
("service" => "remote")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.remoting.remotingConnectorInfoService.\"http-remoting-connector remoting-connector\""],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["org.wildfly.clustering.cache.registry-entry.ejb.client-mappings is missing [jboss.remoting.remotingConnectorInfoService.\"http-remoting-connector remoting-connector\"]"] }
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.