Details
Description
The createTransport method in ActiveMQSslConnectionFactory delegates to the super class if the URI scheme
is not ssl. Failover URIs have 'failover' as the URI scheme and so always delegate to the superclass. This causes
ssl connections that need key or trust stores manipulated by code to hang or fail as the credentials are not available.
Code from SVN trunk for ActiveMQSslConnectionFactory shows why
protected Transport createTransport() throws JMSException {
// If the given URI is non-ssl, let superclass handle it.
if (!brokerURL.getScheme().equals("ssl"))
// !! jackf comment Code below never reached for failover URIs like failover:ssl:... or failover:(tcp:..., ssl...)
// because the URI Scheme is failover, not ssl.
// Therefore connections that need a keyManager or trustManager fail
try {
if (keyManager == null || trustManager == null)
SslTransportFactory sslFactory = new SslTransportFactory();
SslContext ctx = new SslContext(keyManager, trustManager, secureRandom);
SslContext.setCurrentSslContext(ctx);
return sslFactory.doConnect(brokerURL);
} catch (Exception e)
}
(Vague) Solution: 1) need better pattern match than URI scheme to detect requests for ssl connections. 2) A failover URI is essentially a list of URIs so multiple ssl transport requests may be in the failover list. A first start is to require that the same key and trust stores are used for all failover connections but you may want to consider allowing customized stores for each of the ssl connections.