0 Replies Latest reply on May 31, 2017 6:01 AM by Gregor Rosenauer

    cannot access ArtemisMQ ManagementQueue locally in Wildfly 10

    Gregor Rosenauer Newbie

      (god I hate this editor, can the admin.account please support Markdown?:)

       

      Using Wildfly 10.1.0.Final with a Java EE 7 application, we need to display messages queued in a JMS queue. We use the `ManagementQueue` as advised in the Artemis docs from a local Bean on the server:

       

      QueueConnectionFactory connectionFactory = (QueueConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory);

      queueConnection = connectionFactory.createQueueConnection(userName, password);

      queueConnection.start();

      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE;

      Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management");

       

      We tried everything to get this working with a plain or injected InitialContext, but only got it running with using a remote connection factory with JBoss remote ClassLoader:

      ClassLoader classLoader = Class.forName("org.jboss.naming.remote.client.InitialContextFactory").getClassLoader();

      Thread.currentThread().setContextClassLoader(classLoader);

       

      Using the default local connection factory caused errors with Artemis:

      @Inject

      private JMSContext jmsContext;

       

      @Resource(lookup = "java:/ConnectionFactory")

      private QueueConnectionFactory connectionFactory;

       

      The most I could get was an error by Artemis that it did not accept the Destination when trying to create the management queue: "Not an ActiveMQ Artemis Destination", because the Destination we get is not an ActiveMQDestination

       

      I guess this is a missing piece in Artemis/ActiveMQ integration with Wildfly, can anybody confirm this or help?