0 Replies Latest reply on Feb 27, 2018 7:04 AM by Nagaraju Chitimilla

    How to get the JndiParameters value

    Nagaraju Chitimilla Newbie

      We are trying to migrate from JBoss4.2.3 GA to Wildfly 11 version. We the following activemq-jms-ds.xml file:

       

      activemq-jms-ds.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <connection-factories>

        <!-- The ActiveMQ JMS provider loader -->

        <mbean code="org.jboss.jms.jndi.JMSProviderLoader"

        name=":service=JMSProviderLoader,name=ActiveMQjmsProvider">

        <attribute name="ProviderName">ActiveMQJMSProvider</attribute>
        <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

        <attribute name="FactoryRef">ConnectionFactory</attribute>

        <attribute name="QueueFactoryRef">QueueConnectionFactory</attribute>
        <attribute name="TopicFactoryRef">TopicConnectionFactory</attribute>

        <attribute name="Properties">

        java.naming.security.principal=guest

        java.naming.factory.initial=com.ca.jms.utils.ActiveMQJndiContextFactory

        java.naming.provider.url=ssl://localhost:61616?socket.enabledProtocols=TLSv1.1,TLSv1.2

        anonymous=true
        trustAll=true
        xa=true

        queue.queue/DLQ=ActiveMQ.DLQ

        queue.test.queue=test.queue

        </attribute>

        </mbean>

      <!-- use it when open jms connection -->

      <tx-connection-factory>

        <jndi-name>ActivemqJms</jndi-name>

        <use-java-context>false</use-java-context>

        <xa-transaction></xa-transaction>

        <rar-name>jms-ra.rar</rar-name>

        <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>

        <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>

        <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/ActiveMQJMSProvider</config-property>

        <max-pool-size>150</max-pool-size>

      <security-domain-and-application>ActivemqRealm</security-domain-and-application>

        <blocking-timeout-millis>32000</blocking-timeout-millis>

      </tx-connection-factory>

      </connection-factories>

       

       

      and we used the get the properties (Highlighted in blue color) of the activemq-jms-ds.xml using the following code:

       

      InitialContext jmsContext = null;

      try {

          InitialContext tempContext = new InitialContext();

         JNDIProviderAdapter jndProviderAdapter = (JNDIProviderAdapter) tempContext.lookup(JMS_PROVIDER_JNDI);

         Properties jmsProp = jndProviderAdapter.getProperties();

         // getting properties from activemq-jms-ds.xml.

         jmsContext = new InitialContext(jmsProp);

       

       

      } catch (NamingException e) {

         logger.error(e);

      }

          return jmsContext;

      }

       

       

      We have converted the activemq-jms-ds.xml to the respective resource adapter in wildfly

       

      <resource-adapter id="jms-ra.rar">

      <archive>

        jms-ra.rar

      </archive>

        <transaction-support>NoTransaction</transaction-support>

        <connection-definitions>

        <connection-definition class-name="org.jboss.resource.adapter.jms.JmsConnectionFactory" jndi-name="java:/ActivemqJms" pool-name="ActivemqJms" use-ccm="true" enabled="true" use-java-context="true">

        <config-property name="JndiParameters">java.naming.security.principal=guest;java.naming.factory.initial=com.ca.jms.utils.ActiveMQJndiContextFactory;java.naming.provider.url=ssl://localhost:61616?socket.enabledProtocols=TLSv1.1,TLSv1.2</config-property>

        <pool>

        <min-pool-size>1</min-pool-size>

        <max-pool-size>150</max-pool-size>

      </pool>

      <timeout>

        <blocking-timeout-millis>32000</blocking-timeout-millis>

      </timeout>

      <security>

      <security-domain>ActivemqRealm</security-domain>

      </security>

      </connection-definition>

      </connection-definitions>

      </resource-adapter>

       

       

      The Question is how we can get the jndiparameters values in the wildfly?