Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:03:02+00:00 2026-06-12T16:03:02+00:00

I need to connect to a remote queue in my application,but when security enabled

  • 0

I need to connect to a remote queue in my application,but when security enabled in MQ farm it hits Authentication Error (RC 2035),i have been informed that when i use spring configuration its trying to access some default queue which it shouldn’t ,i came across setDirectAuth property,would it solve this issue?please advise if i miss out any property that causes the error?

Error:

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [META-INF/spring.xml]: Invocation of init method failed; nested exception is javax.naming.ServiceUnavailableException: Unable to connect to the target queue manager XXXX.XXX.XXX.com:1415/xxx.SVRCONN [Root exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'.]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [META-INF/spring.xml]: Invocation of init method failed; nested exception is javax.naming.ServiceUnavailableException: Unable to connect to the target queue manager xxxx.xxx.xxx.com:1415/xxx.SVRCONN [Root exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'.]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

Context.xml

<Resource 
    name="jms/MQConnectionFactory" 
    auth="Container" 
    type="com.ibm.mq.jms.MQQueueConnectionFactory" 
    factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory" 
    description="JMS Queue Connection Factory for sending messages" 
    HOST="XX.XXX.XXX.XX"
    PORT="XXXX"
    CHAN="MQ.CHANNEL"
    TRAN="1" 
    QMGR="TEST01"
/> 

<Resource 
    name="jms/QueueSU" 
    auth="Container" 
    type="com.ibm.mq.jms.MQQueue" 
    factory="com.ibm.mq.jms.MQQueueFactory" 
    description="JMS Queue for status update" 
    QU="Q01" 
/> 

<Resource 
    name="jms/QueueBM" 
    auth="Container" 
    type="com.ibm.mq.jms.MQQueue" 
    factory="com.ibm.mq.jms.MQQueueFactory" 
    description="JMS Queue for bond management" 
    QU="Q02" 
/> 

property file:

#JMS Provider
jms.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory
jms.provider.url=xx.xxx.xxx.com:1415/xxx.CHANNEL
destination.factory=java:/comp/env/jms/MQConnectionFactory
bm.queue=java:/comp/env/jms/QueueBM
su.queue=java:/comp/env/jms/QueueSU

Spring.xml

   <!--  JMS BEANS  -->   
    <bean id="bmMessageReceiver" class="com.jms.BMMessageReceiver"/> 
    <bean id="suMessageReceiver" class="com.jms.SUMessageReceiver"/>
    <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">${jms.factory.initial}</prop>
                <prop key="java.naming.provider.url">${jms.provider.url}</prop>
            </props>
        </property>
    </bean>
    <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>${destination.factory}</value>
        </property>
    </bean>
    <bean id="bmMessageQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>${bm.queue}</value>
        </property>
    </bean>
    <bean id="suMessageQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>${su.queue}</value>
        </property>
    </bean>
    <bean id="bmListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="concurrentConsumers" value="5" />
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="destination" ref="bmMessageQueue" />
        <property name="messageListener" ref="bmMessageReceiver" />
        <property name="sessionTransacted" value="true" />
    </bean>
    <bean id="suListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="concurrentConsumers" value="5" />
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="destination" ref="suMessageQueue" />
        <property name="messageListener" ref="suMessageReceiver" />
        <property name="sessionTransacted" value="true" />
    </bean>    
 <!--    JMS END   --> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:03:03+00:00Added an answer on June 12, 2026 at 4:03 pm

    When your app opens a local queue, the authorization profiles match the name of the queue that was opened. In other words, if the app connected to LOCALQMGR opens SYSTEM.DEF.LOCAL.QUEUE@LOCALQMGR the authorization control list entry on LOCALQMGR must grant the app access to SYSTEM.DEF.LOCAL.QUEUE.

    However, when the app opens SOME.QUEUE@REMOTEQMGR the QMgr resolves REMOTEQMGR and finds a transmission queue leading to that QMgr. The queue it opens in this case is the transmission queue therefore it looks for an authorization profile that matches the transmission queue. Authorizing an app to the XMitQ can be OK but it allows the app to address messages to any queue on that QMgr including, for example, the command queue.

    Many times, administrators do not wish to grant access to transmission queues directly because it allows access to any queue on that QMgr and they’d rather restrict that. So in a point-to-point interface, it is common to set up a QRemote locally and authorize the app to that. In a cluster, it is common to set up a local QAlias over a clustered queue and attach the authorization profile to that.

    The only thing that will affect this is the user ID the app uses for the connection request. If the QMgr is secure, there is NOTHING the app can do to affect this connection ID. The MQ admin will have either set the ID in the channel definition or mapped it from the IP address or the SSL certificate distinguished name. If for some reason the QMgr is not secure, the app can specify the ID to use on the connection as part of the API call:

    connection = ConnectionFactory.createConnection(userID, password);
    

    If the MQ admin has not set or mapped MCAUSER on the channel, the QMgr will accept the ID you provide and the password is not checked. If the MQ admin configures a channel exit, the exit can validate the password against LDDAP, AD, local OS, etc. But if not exit is installed, the password is not checked.

    Now that you know this, you may be able to answer your question about the effect of setDirectAuth (because I can’t). If that parameter is inherited by the connection factory and is asserted by the channel request it would be passed to MQ and, if the channel isn’t secure, would be accepted. Similarly, if you used the Connection object constructor that takes ID and password, you can DEFINITELY assert an ID which, if the channel is not secure, will be accepted by the QMgr.

    You can test this using the following:

    connection = ConnectionFactory.createConnection('mqm', 'doesntmatter');
    

    If the QMgr is on UNIX/Linux and not secure, the app will run as mqm. I would not suggest running like this, the correct response would be to secure it. But this is one way to test and see whether it is secure or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a application with JPA Hibernate without Spring and I need connect to
I need to connect to a remote mysql database in PHP. Specifically I have
I have a java application connect to a remote CentOS using ssh connection. There's
I need to connect to a remote MySQL database and have created the following
I need to connect to Oracle9,10 and 11 in my java application.The client will
I need to connect Apache Axis 1.4 to a Webservice that uses NTLM authentication
I need to connect to a MongoDB instance from my EJB3 application, running on
i need to connect to another server we manage and have it's results (in
I need to connect to SAP and do a simple update but it will
I need to connect to a MySQL remote database from my eclipse project. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.