4 Replies Latest reply on May 29, 2013 3:36 AM by au lai seong

    How to configure mdb using encrypted password in jboss.xml

    au lai seong Newbie

      How to configure mdb using encrypted password in jboss.xml for JBOSS 5?

      In jboss7, it is able to point to JmsProviderAdapterJNDI in  @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="WSIBMMQJMSProvider")

        • 1. Re: How to configure mdb using encrypted password in jboss.xml
          au lai seong Newbie

          Let me clarify the question. I want to use the encrypted password defined in JmsXARealm. But jboss seem does not know the username password shown in the error. Anyone can help?

           

          <application-policy name = "JmsXARealm">

                 <authentication>

                  <login-module code = "org.jboss.resource.security.SecureIdentityLoginModule"

                       flag = "required">

                                  <module-option name = "username">jms.username</module-option>

                          <module-option name = "password">-e23r324rewr323232</module-option>

                       <module-option name = "managedConnectionFactoryName">jboss.jca:service=XATxCM,name=JmsXA</module-option>

                    </login-module>

                 </authentication>

              </application-policy>

           

             <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name=":service=JMSProviderLoader,name=TibjmsProvider">

                <attribute name="ProviderName">TIBCOJMSProvider</attribute>

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

                <attribute name="QueueFactoryRef">jms.queue.conn.factory</attribute>

                <attribute name="TopicFactoryRef">jms.topic.conn.factory</attribute>

                <attribute name="Properties">

          <!-- comment following username and password inorder to use encrypted password in JmsXARealm

                java.naming.security.principal=username
          java.naming.security.credentials=password

          -->

                     java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory

                     java.naming.factory.url.pkgs=com.tibco.tibjms.naming

                     java.naming.provider.url=http://localhost:111/

                </attribute>

             </mbean>

          <jboss>

           

            <enterprise-beans>

              <message-driven>

                        <ejb-name>manager.MDB</ejb-name>

                        <activation-config>

                                   <activation-config-property>

                                      <activation-config-property-name>providerAdapterJNDI</activation-config-property-name>

                                      <activation-config-property-value>TIBCOJMSProvider</activation-config-property-value>

                                   </activation-config-property>

                         </activation-config>

                    <destination-jndi-name>jms.queue.request</destination-jndi-name>

          <!-- comment following username and password inorder to use encrypted password in JmsXARealm




          <mdb-user>username</mdb-user>



          <mdb-passwd>password</mdb-passwd>

          -->

           

              </message-driven>

            </enterprise-beans>

          </jboss>

           

          <tx-connection-factory>

                <jndi-name>JmsXA</jndi-name>

                <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.Topic</config-property>

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

                <max-pool-size>20</max-pool-size>

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

             </tx-connection-factory>

           

           

          Error in jboss when startup

          -------------------------------------------

          2013-05-25 12:41:49,482 ERROR [org.jboss.resource.adapter.jms.inflow.JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@715c057c(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@4b704006 destination=request destinationType=javax.jms.Queue tx=true durable=true reconnect=10 provider=TIBCOJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=30000 useDLQ=false)

          javax.naming.AuthenticationException: Not permitted: invalid name or password [Root exception is javax.jms.JMSSecurityException: invalid name or password]

          • 3. Re: How to configure mdb using encrypted password in jboss.xml
            cliff dias Newbie

            The easiest way to do this is to override the JNDI Adapter

             

            e.g.

             

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

            <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name=":service=JMSProviderLoader,name=TibjmsProvider">

                  <attribute name="ProviderName">TIBCOJMSProvider</attribute>

                  <attribute name="ProviderAdapterClass">com.vodafone.tibco.jndi.provider.JNDIProviderAdapter</attribute>

                  <!--attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute-->

                  <attribute name="QueueFactoryRef">GIGQueueConnectionFactory</attribute>

                  <attribute name="TopicFactoryRef">GIGTopicConnectionFactory</attribute>

                  <attribute name="Properties">

                            java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory

                            java.naming.factory.url.pkgs=com.tibco.tibjms.naming

                            java.naming.provider.url=tcp://192.168.126.156:20010</attribute>

            </mbean>

             

            Over ridden class

             

            public class JNDIProviderAdapter extends org.jboss.jms.jndi.JNDIProviderAdapter {

             

                         public JNDIProviderAdapter()

                         {

                                   super();

                         }

                        

                         public Context getInitialContext() throws NamingException

                         {

                                  

                            if (properties == null)

                            {

                                               Properties augmentedProperties = new Properties(properties);

                     

                                               augmentedProperties.setProperty("java.naming.security.principal", "cliff");

                                               augmentedProperties.setProperty("java.naming.security.credentials", "password");

                                               augmentedProperties.setProperty("java.naming.factory.initial", "com.tibco.tibjms.naming.TibjmsInitialContextFactory");

                                               augmentedProperties.setProperty("java.naming.factory.url.pkgs", "com.tibco.tibjms.naming");

                                               augmentedProperties.setProperty("java.naming.provider.url", "tcp://localhost:20010");

                                     

                               return new InitialContext(augmentedProperties);

                            }

                            else

                            {

                                     Properties augmentedProperties = new Properties(properties);

                                    

                                     System.out.println(properties.toString());

                        

                                     augmentedProperties.setProperty("java.naming.security.principal", "cliff");

                                     augmentedProperties.setProperty("java.naming.security.credentials", "password");

                                     augmentedProperties.setProperty("java.naming.factory.initial", properties.getProperty("java.naming.factory.initial"));

                                     augmentedProperties.setProperty("java.naming.factory.url.pkgs", properties.getProperty("java.naming.factory.url.pkgs"));

                                     augmentedProperties.setProperty("java.naming.provider.url", properties.getProperty("java.naming.provider.url"));

                                    

                                     System.out.println(augmentedProperties.toString());

                               return new InitialContext(augmentedProperties);

                            }

                         }

            }

            • 4. Re: How to configure mdb using encrypted password in jboss.xml
              au lai seong Newbie

              This is what i am trying to do but there is another password setting which is in jboss.xml