`

Tomcat6+spring+IBM MQ

 
阅读更多
1在Tomcat 6.0下用JNDI连接IBM MQ 6.0的配置方法
http://blog.csdn.net/justin4wd/article/details/2957670

其中有两个jar包比较难找,
然后MQ默认的编码字符集标识(CCSID)为1381,必须得改没办法
记得发送和接受的两个队列管理器要改一致,不然还是无法发送
runmqsc QM(队列管理器名称)
dis qmgr (可以看CCSID)
(1)    启动QueueManager
(2)    在Dos命令行窗口下:
\>  runmqsc QueueManager  (回车)
ALTER QMGR FORCE CCSID(437)
 
End   (退出)
(3)    重启QueueManager
如果一切正常,QueueManager的CCSID会修改为437




2第二个问题,没有权限的问题
MQJMS2013: 提供了 MQQueueManager 的无效安全性认证
引用

如下右击你的通道名称,然后点击属性,在弹出的窗口里面选择MCA,并在MCA用户表示处输入:MUSR_MQADMIN



MQ7.0 在WAS中配置队列链接工厂并测试连接报2035错误
http://blog.csdn.net/javalover_yao/article/details/6387460
修改了MCA 然后终于可以了

后续...


关于jndiTemplate
网上的介绍ActiveMQ的最多
确少有IBM MQ和tomat
后面测了下,其实tomcat下的定义是这样的,呵呵(同义词)
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" />

Spring 系列:Spring JMS 消息处理(关于IBM MQ)
http://www.knowsky.com/350313.html
引用

3. JNDI 查询的 JNDI 模板配置

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
      <props>
        <prop key="java.naming.factory.initial">
            com.sun.jndi.fscontext.RefFSContextFactory
        </prop>
        <prop key="java.naming.provider.url">
            file:/C:/JNDI-Directory
        </prop>
      </props>
    </property>
  </bean>

以上配置进行 JNDI 查询时用 com.sun.jndi.fscontext.RefFSContextFactory 指定初始上下文工厂,用基于文件的 file:/C:/JNDI-Directory 作为提供者 URL。根据示例应用程序的意图,JNDI 访问会采用基于文件的 FSContext 版本(请参阅 参考资料)的配置把 MQ 队列绑定到 JNDI。



部署到was7 上,定义哈了队列管理器等资源
报了
引用

Caused by: javax.jms.IllegalStateException: Method setExceptionListener not permitted
at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:253)
at com.ibm.ejs.jms.JMSConnectionHandle.checkRestrictedMethod(JMSConnectionHandle.java:834)
at com.ibm.ejs.jms.JMSConnectionHandle.setExceptionListener(JMSConnectionHandle.java:335)
at org.springframework.jms.listener.SimpleMessageListenerContainer.prepareSharedConnection(SimpleMessageListenerContainer.java:234)
at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:406)
at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:372)
at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:279)
at org.springframework.jms.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:224)
at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:264)
... 110 more


跟了下代码跟IBM的
Sring3.1.1 SimpleMessageListenerContainer类的这个方法保错
@Override
protected void prepareSharedConnection(Connection connection) throws JMSException {
		super.prepareSharedConnection(connection);
		[color=red]connection.setExceptionListener(this);[/color]	}

IBM的没有这个权限??

修改了spring jms的配置为default,不用simple了
正常启动,仍然接受不到信息
引用

[12-10-15 15:50:22:237 CST] 000000ee DefaultMessag W org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS message listener invoker failed for destination 'java:comp/env/jms/recQueue' - trying to recover. Cause: Destination [java:comp/env/jms/recQueue] not found in JNDI; nested exception is javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.  This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request.  Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.  Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/env/jms not found in context "java:".]
[12-10-15 15:50:22:241 CST] 000000ee DefaultMessag I org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful Successfully refreshed JMS Connection



解决是
websphere下destination="jms/recQueue"
不要加 java:comp/env/
但是tomcat需要
<jms:listener-container connection-factory="jmsConnectionFactory"
		container-type="default" destination-resolver="destinationResolver">
		<jms:listener destination="java:comp/env/jms/recQueue" ref="roneMessageListener" />
	</jms:listener-container>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics