'Red Hat EAP 7.2 ActiveMQ Artemis over SSL in Openshift 3.11
I have the following scenario:
- Red Hat EAP 7.2 configured with SSL.
- ActiveMQ Artemis configured to use https acceptor/connector.
Testing on a local installation, I am able to send a test message to a test queue on https 8443.
When deploying the same configuration on Openshift 3.11 I'm not able to deliver a test message. So wrap it up on OSCP side:
- Red Hat EAP 7.2 configured with SSL.
- ActiveMQ Artemis configured to use https acceptor/connector.
- Openshift route is set-up as passthrough -> 8443.
Adding standalone-full.xml
<subsystem xmlns="urn:jboss:domain:messaging-activemq:4.0">
<server name="default">
<journal pool-files="10"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" **socket-binding="https"** endpoint="http-acceptor">
<param name="ssl-enabled" value="true"/>
</http-connector>
<http-connector name="http-connector-throughput" **socket-binding="https"** endpoint="http-acceptor-throughput">
<param name="ssl-enabled" value="true"/>
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="https">
<param name="ssl-enabled" value="true"/>
</http-acceptor>
<http-acceptor name="http-acceptor-throughput" http-listener="https">
<param name="ssl-enabled" value="true"/>
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="TestQ" entries="queue/TestQ java:/jboss/exported/jms/queue/TestQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" **connectors="http-connector"**/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
<http-connector name="http-remoting-connector" **connector-ref="https"** security-realm="ApplicationRealm"/>
</subsystem>
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
<keystore path="/opt/jboss/security/xxx.keystore" keystore-password="xxx" alias="xxx"/>
</ssl>
</server-identities>
<authentication>
<truststore path="/opt/jboss/security/xxx.jks" keystore-password="xxx"/>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>
<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" secure="true" security-realm="ApplicationRealm" enabled-cipher-suites="HIGH:!aNULL:!eNULL:!DES:!RC4:!MD5:!RC2:!IDEA:!EXPORT" enabled-protocols="TLSv1.1,TLSv1.2"/>
<host name="default-host" alias="localhost"/>
</server>
<servlet-container name="default">
<jsp-config x-powered-by="false"/>
<websockets/>
</servlet-container>
</subsystem>
Besides of the above, I also tried configuring an outbound-socket as below and binding the connector to use it:
<outbound-socket-binding name="https-messaging">
<remote-destination host="${jboss.messaging.host:localhost}" port="${jboss.http.port:8443}"/>
</outbound-socket-binding>
Startup command is using -Djboss.bind.address and -Djboss.messaging.host=, both binding to the pod's IP.
Client JMS code:
public class HelloWorldJMSClient {
private static final Logger log = Logger.getLogger(HelloWorldJMSClient.class.getName());
// Set up all the default values
private static final String DEFAULT_MESSAGE = "Hello, World!";
private static final String DEFAULT_CONNECTION_FACTORY = "jms/RemoteConnectionFactory";
private static final String DEFAULT_DESTINATION = "jms/queue/TestQ";
private static final String DEFAULT_MESSAGE_COUNT = "1";
private static final String DEFAULT_USERNAME = "jmsuser";
private static final String DEFAULT_PASSWORD = "jmsuser@123";
private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";
//private static final String INITIAL_CONTEXT_FACTORY = "org.wildfly.naming.client.WildFlyInitialContextFactory";
private static final String PROVIDER_URL = "https-remoting://myOpenshiftRouteURL:443";
When running te JMS java app, getting below exception:
Feb 03, 2022 9:47:31 AM HelloWorldJMSClient main
INFO: Attempting to acquire connection factory "jms/RemoteConnectionFactory"
Feb 03, 2022 9:47:34 AM HelloWorldJMSClient main
INFO: Found connection factory "jms/RemoteConnectionFactory" in JNDI
Feb 03, 2022 9:47:34 AM HelloWorldJMSClient main
INFO: Attempting to acquire destination "jms/queue/TestQ"
Feb 03, 2022 9:47:34 AM HelloWorldJMSClient main
INFO: Found destination "jms/queue/TestQ" in JNDI
Feb 03, 2022 9:47:55 AM HelloWorldJMSClient main
SEVERE: Failed to create session factory
Exception in thread "main" javax.jms.JMSException: Failed to create session factory
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:837)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:282)
at HelloWorldJMSClient.main(HelloWorldJMSClient.java:69)
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:797)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:835)
... 2 more
Please let me know if I was explicit enough on describing the setup in Openshift. I cannot figure out what's missing though, or what I'm doing wrong. Any suggestions/inputs/hints are highly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
