嗨StackOverflow社区,无法使用JNDI连接到Websphere MQ
我目前使用Spring连接到一个队列。我希望能够在我们的测试VS我们的UAT环境中配置我可以连接的提供商。在UAT中,我们使用IBM WMQ 7;在测试中,我们使用的是ActiveMQ。
我们在这两种情况下也使用SSL连接。
目前,我们有以下的配置,其适用于连接到WMQ 7:
<bean id="jmsFactory" name="jmsFactory" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="queueManager" value="${UM_MQ_QM}" />
<property name="hostName" value="${UM_MQ_HOST}" />
<property name="channel" value="${UM_MQ_CHANNEL}" />
<property name="port" value="${UM_MQ_PORT}" />
<property name="transportType" value="1" />
<property name="SSLCipherSuite" value="${SSL_CIPHER_SUITE}" />
</bean>
使用JNDI,我能够连接到ActiveMQ的。但是当切换提供者类时,它给了我以下例外。
春JNDI配置:
<bean id="jmsFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="QueueConnectionFactory" />
<property name="jndiTemplate" ref="jndiTemplate" />
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.ibm.mq.jms.context.WMQInitialContextFactory</prop>
<prop key="java.naming.provider.url">${UM_MQ_HOST}:${UM_MQ_PORT}/${UM_MQ_CHANNEL}</prop>
</props>
</property>
</bean>
例外:
Caused by: javax.naming.NamingException: Caught an Exception trying to create the admin queue. Exception was: com.ibm.mq.pcf.PCFException: MQJE001: Completion Code '2', Reason '2035'. [Root exception is com.ibm.mq.pcf.PCFException: MQJE001: Completion Code '2', Reason '2035'.]
at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:294)
at com.ibm.mq.jms.context.WMQInitialContextFactory.getInitialContext(WMQInitialContextFactory.java:29)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
... 109 more
Caused by: com.ibm.mq.pcf.PCFException: MQJE001: Completion Code '2', Reason '2035'.
at com.ibm.mq.pcf.PCFMessageAgent.send(PCFMessageAgent.java:241)
at com.ibm.mq.jms.context.MQContext.<init>(MQContext.java:273)
... 125 more
我怀疑这是由于无论是两件事情:
- 我们没有明确权限的设置JMS管理队列如上所述
- 密码设置不起作用弹簧配置
任何人都可以提供一些指导?如果您之前遇到过这个问题,那么解决方案是什么?
我肯定的答案在我的脸盯着权,只是在我的眼睛有些雾:)
感谢,
何塞
我相信你已经看过这个http://stackoverflow.com/questions/12889953/unable-to-connect-to-queue-manager-in-websphere-mq-7-1 – Ashish