I am trying to connect JMS queue on JBoss EAP 7.2 using Java. My code to get the initial context is below:
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
env.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");
env.put(Context.SECURITY_PRINCIPAL, "jms123");
env.put(Context.SECURITY_CREDENTIALS, "jms123");
return new InitialContext(env);
And after getting the InitialContext
I'm trying to get the connection factory as below:
qconFactory = (QueueConnectionFactory) initialContext.lookup("java:jboss/exported/jms/RemoteConnectionFactory");
But I'm not able to get the connection factory.
Note: I tried using jboss/exported/jms/RemoteConnectionFactory
and jms/RemoteConnectionFactory
as well.
I am getting the below exception:
NamingException caught while trying to create connection:javax.naming.NamingException: WFLYNAM0027:
Failed instantiate InitialContextFactory weblogic.jndi.WLInitialContextFactory from classloader
ModuleClassLoader for Module "deployment.***.jar" from Service Module Loader [Root exception is
java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory from [Module "
deployment.***.jar" from Service Module Loader]];jsessionid=MwSDukhCPIR813I4R8-GWocZZgzVy-srp6eCb-If
FatalException: Trouble opening session with JMS Sender instance:FatalException: Could not get
connection to Queue
javax.naming.NameNotFoundException: jboss -- service jboss.naming.context.java.jboss.exported.jboss
My xml config is below:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:4.0">
<server name="default">
<journal pool-files="10"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="MailJMSServer" entries="java:jboss/exported/jms/queue/ConcurrentBEQueue"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
Please help me find out the root cause.