Remote ActiveMQ from a JBoss Module

Latest response

I am trying to update a custom module that implements a custom log handler that pushes information from one EAP 7.2 server to the queue on another for remote logging. Unfortunately, I am having difficulty establishing the InitialContext from the our jar file in the module, because I am getting a ClassNotFoundException on org.wildfly.naming.client.WildFlyInitialContextFactory:

Caused by: java.lang.ClassNotFoundException: org.wildfly.naming.client.WildFlyInitialContextFactory from [Module "org.jboss.as.standalone" from local module loader @6d78f7d2 (finder: local module finder @44d1ed88 (roots: C:\Source\world\eship\eship_ear\target\eship_jboss_7.2-1.2\modules,C:\Source\world\eship\eship_ear\target\eship_jboss_7.2-1.2\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)

I have tried adding the wildfly naming client as a module dependence, but it doesn't seem to solve this issue. Any help resolving this would be greatly appreciated. Here is the client code in the module jar file (I have attached the module.xml file):

        final Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
        env.put(Context.PROVIDER_URL, "remote+http://" + host + ":" + port);
        env.put(Context.SECURITY_PRINCIPAL, loggingUser);
        env.put(Context.SECURITY_CREDENTIALS, loggingPwd);

        Context namingContext = null;
        try {
            namingContext = new InitialContext(env);

            connectionFactory = (ConnectionFactory) namingContext.lookup("jms/RemoteConnectionFactory");
            destination = (Destination) namingContext.lookup(queue);
            context = connectionFactory.createContext(loggingUser, loggingPwd);
            producer = context.createProducer();

            if (serverName == null) {
                serverName = System.getProperty("jboss.node.name");
            }
            if (serverIP == null) {
                serverIP = System.getProperty("jboss.bind.address");
            }
        } catch (Exception errOpen) {
            errOpen.printStackTrace();
            try {
                if (context != null) {
                    context.close();
                }
            } catch (Exception errClose) {
                // Don't care about these.
            }
            throw errOpen;
        } finally {
            if (namingContext != null) {
                namingContext.close();
            }
        }
  • Module.xml
    ```xml
    <module name="org.wildfly.naming-client" xmlns="urn:jboss:module:1.3"

    ```

Attachments

Responses

content removed

-- Module.xml ~


~