3

I am attempting to use the ActiveMQ Artemis Core API to connect to ActiveMQ Artemis running in a docker container.

I am using the following code to attempt the connection.

Map<String,Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(TransportConstants.PORT_PROP_NAME, "61616");
connectionParams.put(TransportConstants.HOST_PROP_NAME, "localhost");


TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName(),connectionParams);

ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(tc);

ClientSessionFactory queueFactory = locator.createSessionFactory();

Upon running I get the following error when I attempt to create the session factory.

ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]

It seems to be that I am missing a critical configuration step when trying to connect to the ActiveMQ Artemis broker. Is there an XML file I need to place somewhere in my Java client application or can I set the proper settings in code?

The Docker image for AtiveMQ Artemis I am using:

https://github.com/vromero/activemq-artemis-docker

AdnanEK
  • 198
  • 1
  • 4
  • 13

1 Answers1

3

Maybe you forgot to expose the port publicly via -p 61616:61616

Lexandro
  • 765
  • 5
  • 14
  • 1
    Yup...that's exactly what it was. Tested it using the Docker IP and it worked, then made sure to publish the port and it worked with localhost too. – AdnanEK Sep 09 '16 at 14:15