javax.jms.JMSException: Failed to create session factory while sending message to embedded ActiveMQ Artemis within JBoss EAP 7.2

前端 未结 1 558
萌比男神i
萌比男神i 2021-01-27 06:53

I am trying to develop a program that will send message to ActiveMQ Artemis embedded in JBoss EAP 7.2. I have followed the instructions given in this question:

Below is

相关标签:
1条回答
  • 2021-01-27 07:27

    When you use the -b switch on the command-line when starting the server that means all the socket-bindings in your socket-binding-group will be bound to that IP address by default.

    Your JMS client is looking up jms/RemoteConnectionFactory. Here's the configuration for that connection-factory:

    <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
    

    This connection-factory is using the http-connector. Here's the config for the http-connector:

    <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
    

    This is using the http socket-binding which is using the internal IP address since you're using the -b switch on the command-line when starting the server. Therefore when your remote JMS client looks up jms/RemoteConnectionFactory it will get a connection factory pointing to the internal IP address which will fail.

    To resolve this issue you need to configure RemoteConnectionFactory to use the external IP address.

    First, define a new interface, e.g.:

    <interface name="external">
        <inet-address value="${jboss.bind.address.external:<<EXTERNAL-IP>>}"/>
    </interface>
    

    You can configure the actual external IP address here or you can pass it on the command-line using -Djboss.bind.address.external=<<EXTERNAL-IP>>.

    Second, define a new socket-binding to use this interface:

    <socket-binding name="external" interface="external" port="${jboss.http.port:8080}"/>
    

    Third, define a new http-connector to use this socket-binding:

    <http-connector name="http-connector-external" socket-binding="external" endpoint="http-acceptor"/>
    

    Fourth, change RemoteConnectionFactory to use this http-connector:

    <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector-external"/>
    
    0 讨论(0)
提交回复
热议问题