[Artemis] Invalid keys during XA Recovery from HornetQ client

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Artemis] Invalid keys during XA Recovery from HornetQ client

Benjamin Buehlmann
This post was updated on .
I configured a ActiveMQ Artemis 2.4.0 HA setup with replication and a static cluster connection of the two nodes (live- and backup node). As one of the test clients I use a JBoss EAP 6.3.2 with embedded HornetQ.

Every two minutes a see a Warning in the clients log that some keys are not know by the client side HornetQ ClientSessionFactoryImpl. Please find below the stacktrace and the configuration of the broker and client.

Can I fix somehow this behaviour? Or do I need to integrate the Artemis resource adapter on the JBoss instances?


Warning on client side appears every 2 Minutes (recovery interval):
[org.hornetq.jms.server] (Periodic Recovery) HQ122015: Can not connect to XARecoveryConfig [transportConfiguration = [TransportConfiguration(name=messaging-connector, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?trustStorePath=/data/artemis/data/--/etc/keys/truststore-jks&port=61616&sslEnabled=true&trustStorePassword=123456&host=node1-corp&keyStorePath=/data/artemis/data/--/etc/keys/keystore-jks&useEpoll=true&keyStorePassword=123456], discoveryConfiguration = null, username=***, password=***] on auto-generated resource recovery: java.lang.IllegalStateException: The following keys are invalid for configuring a connector: trustStorePath, sslEnabled, trustStorePassword, useEpoll, keyStorePath, keyStorePassword
        at org.hornetq.core.client.impl.ClientSessionFactoryImpl.checkTransportKeys(ClientSessionFactoryImpl.java:1540)
        at org.hornetq.core.client.impl.ClientSessionFactoryImpl.<init>(ClientSessionFactoryImpl.java:212)
        at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:864)
        at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:378)
        at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:287)
        at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:75)
        at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecoveryFirstPass(XARecoveryModule.java:548)
        at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkFirstPass(XARecoveryModule.java:187)
        at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:743)
        at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371)


Configuration of broker (Artemis 2.4.0)
==================================
....
  <ha-policy>
    <replication>
      <master>
        <group-name>artemis-group-testenv</group-name>
        <check-for-live-server>true</check-for-live-server>
        <initial-replication-sync-timeout>30000</initial-replication-sync-timeout>
      </master>
    </replication>
  </ha-policy>
  ....
  <connectors>
    <connector name="messaging-connector">tcp://node1.corp:61616?useEpoll=true;sslEnabled=true;keyStorePath=${data.dir}/../etc/keys/keystore.jks;keyStorePassword=123456;trustStorePath=${data.dir}/../etc/keys/truststore.jks;trustStorePassword=123456</connector>
    <connector name="messaging-backup-connector">tcp://node2.corp:61616?useEpoll=true;sslEnabled=true;keyStorePath=${data.dir}/../etc/keys/keystore.jks;keyStorePassword=123456;trustStorePath=${data.dir}/../etc/keys/truststore.jks;trustStorePassword=123456</connector>
  </connectors>
  <acceptors>
    <acceptor name="netty-acceptor">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;sslEnabled=true;keyStorePath=${data.dir}/../etc/keys/truststore.jks;keyStorePassword=123456;trustStorePath=${data.dir}/../etc/keys/keystore.jks;trustStorePassword=123456</acceptor>
  </acceptors>
  <cluster-connections>
    <cluster-connection name="ha-cluster-connection">
      <connector-ref>messaging-connector</connector-ref>
      <static-connectors>
        <connector-ref>messaging-backup-connector</connector-ref>
      </static-connectors>
    </cluster-connection>
  </cluster-connections>
  ....


Configuration of client (JBoss EAP 6.3.2):
==================================
<subsystem xmlns="urn:jboss:domain:messaging:1.2">
  <hornetq-server>
    <connectors>
      <connector name="netty-ssl_1">
        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
        < param key="host" value="node1.corp" />
        < param key="port" value="61616" />
        < param key="ssl-enabled" value="false" />
        < param key="key-store-path" value="${jboss.server.config.dir}/keys/keystore.jks" />
        < param key="key-store-password" value="123456" />
      </connector>
      <connector name="netty-ssl_2">
        <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
        < param key="host" value="node2.corp" />
        < param key="port" value="61616" />
        < param key="ssl-enabled" value="false" />
        < param key="key-store-path" value="${jboss.server.config.dir}/keys/keystore.jks" />
        < param key="key-store-password" value="123456" />
      </connector>
    </connectors>
    <jms-connection-factories>
      <pooled-connection-factory name="hornetq-ra">
        <transaction mode="xa" />
        <connectors>
          <connector-ref connector-name="netty-ssl_1" />
          <connector-ref connector-name="netty-ssl_2" />
        </connectors>
        <entries>
          <entry name="java:/JmsXA" />
          <entry name="java:/RemoteJmsXA" />
        </entries>
        <inbound-config>
          <setup-attempts>100</setup-attempts>
          <setup-interval>10000</setup-interval>
        </inbound-config>
        <user>***</user>
        <password>***</password>
        <reconnect-attempts>-1</reconnect-attempts>
        <consumer-window-size>1048576</consumer-window-size>
        <retry-interval>5000</retry-interval>
      </pooled-connection-factory>
    </jms-connection-factories>
    <jms-destinations>
      <jms-queue name="foo">
        <entry name="java:/jms/queue/foo" />
      </jms-queue>
    </jms-destinations>
  </hornetq-server>
</subsystem>


--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Justin Bertram
I'd try using the Artemis JCA RA.  You can build it using the
<ARTEMIS_HOME>/examples/features/sub-modules/artemis-ra-rar example shipped
with the broker.


Justin

On Fri, Nov 17, 2017 at 9:14 AM, Benjamin Buehlmann <
[hidden email]> wrote:

> I configured a ActiveMQ Artemis 2.4.0 HA setup with replication and a
> static
> cluster connection of the two nodes (live- and backup node). As one of the
> test clients I use a JBoss EAP 6.3.2 with embedded HornetQ.
>
> Every two minutes a see a Warning in the clients log that some keys are not
> know by the client side HornetQ ClientSessionFactoryImpl. Please find below
> the stacktrace and the configuration of the broker and client.
>
> Can I fix somehow this behaviour? Or do I need to integrate the Artemis
> resource adapter on the JBoss instances?
>
>
> Warning on client side appears every 2 Minutes (recovery interval):
>
>
>
> Configuration of broker (Artemis 2.4.0)
> ==================================
>
>
>
> Configuration of client (JBoss EAP 6.3.2):
> ==================================
>
>
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Benjamin Buehlmann
The client receives the properties of the cluster connection configured on
the serverside. Is there any possibility to define a separate connector
(server or client side, does not matter in our use case) used for XA
Recovery?

Deployment and configuration of the Artemis RA on every client is the last
option we would consider..



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Justin Bertram
> Is there any possibility to define a separate connector (server or client
side, does not matter in our use case) used for XA Recovery?

I don't think so, but it's been awhile since I looked at that bit of code
in HornetQ.

I think you could disable recovery by setting
<use-auto-recovery>false</use-auto-recovery>
on the pooled-connection-factory.



Justin

On Fri, Nov 17, 2017 at 11:12 AM, Benjamin Buehlmann <
[hidden email]> wrote:

> The client receives the properties of the cluster connection configured on
> the serverside. Is there any possibility to define a separate connector
> (server or client side, does not matter in our use case) used for XA
> Recovery?
>
> Deployment and configuration of the Artemis RA on every client is the last
> option we would consider..
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Benjamin Buehlmann
The attribute <use-auto-recovery>works well to disable the recovery, but we
need XA recovery on several applications. So I tried to build the Artemis
RAR. Two questions came up:

1. Is it possible to build Artemis RAR under Java 7?

2. I am trying to configure the RA to use with SSL, but don't get it right
now. Always get an Error on the Serverside: "ERROR
[org.apache.activemq.artemis.core.server] AMQ224088: Timeout (10 seconds)
while handshaking has occurred."

My configuration so far of the RA deployed in JBoss EAP 6.4:
<resource-adapter id="artemis-rar.rar">
    <archive>
        artemis-rar.rar
    </archive>
    <transaction-support>XATransaction</transaction-support>
    <config-property name="password">
        ***
    </config-property>
    <config-property name="connectionParameters">
       
host=node1.corp;port=61616;ssl-enabled=true;key-store-path=/path/to/keystore/store.jks;key-store-password=***;
    </config-property>
    <config-property name="connectorClassName">
       
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory
    </config-property>
    <config-property name="userName">
        ***
    </config-property>
    <config-property name="hA">
        true
    </config-property>
    <connection-definitions>
        <connection-definition
class-name="org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory"
jndi-name="java:/JmsXA java:/RemoteJmsXA
java:jboss/DefaultJMSConnectionFactory" enabled="true"
use-java-context="true" pool-name="ActiveMQConnectionFactoryPool"
use-ccm="true">
            <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>20</max-pool-size>
                <prefill>false</prefill>
                <is-same-rm-override>false</is-same-rm-override>
            </xa-pool>
            <recovery>
                <recover-credential>
                    <user-name>***</user-name>
                    <password>***</password>
                </recover-credential>
            </recovery>
        </connection-definition>
    </connection-definitions>
    <admin-objects>
        <admin-object
class-name="org.apache.activemq.artemis.jms.client.ActiveMQQueue"
jndi-name="java:/queue/test.queue" use-java-context="true"
pool-name="test.queue">
            <config-property name="PhysicalName">
                test.queue
            </config-property>
        </admin-object>
    </admin-objects>
</resource-adapter>




--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Benjamin Buehlmann
Any opinions about the last question if it's possible to build the Artemis
Resource Adapter for Java 7 based clients like EAPs < 6.3.3?



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Justin Bertram
The "connectionParameters" in your RA config should use camel case rather
than dashes.  For example "ssl-enabled" should be "sslEnabled", etc.  That
will probably fix your SSL issue.

I wouldn't expect the admin object to work as I don't believe the Artemis
RA supports admin objects.

The best way to see if you can build the RA for Java 7 is just to try it.
I've looked several times and I've never found a way to statically analyze
a file, package, module, project, etc. to see what Java version it is
actually compatible with and why.


Justin

On Mon, Nov 27, 2017 at 7:14 AM, Benjamin Buehlmann <
[hidden email]> wrote:

> Any opinions about the last question if it's possible to build the Artemis
> Resource Adapter for Java 7 based clients like EAPs < 6.3.3?
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: [Artemis] Invalid keys during XA Recovery from HornetQ client

Benjamin Buehlmann
Thanks Justin!

I just looked at the maven definitions of the artemis project and found:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

Hence I assumed they are using Java 8 language Features. I will try it later
this week and let you know if it compiles.

I will try camel case instead of kebab case (nice name :) for the connection
parameters.



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html