`
ChinaHopes
  • 浏览: 14511 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

weblogic和mq的集成。

阅读更多
weblogic:8.1 sp2
MQ:5.3

摘要:把weblogic 和MQ集成起来是非常有价值的应用。本文讨论使用weblogic的Foreign JMS Server 配置JNDI,MDB配置,使用MQ提供的
JMSADMIN配置MQ的jndi。也没有那么详细啦,还是需要读者自己作一番小小的努力的。

关键词:jms,Weblogic foreign JMS Server,JNDI,JMSAdmin

开始:
1、安装Weblogic 和MQ(废话)。
2、配置JMSAdmin(就是在 mq安装目录下的 java/bin/目录里没有扩展名的的文件)
uncomment下面两行,同时在你的机器上建相应的目录C:/JNDI-Directory



INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory 

PROVIDER_URL=file:/C:/JNDI-Directory    



以上配置适用于使用文件jndi。
3、配置mq的jndi
下面使用jmsadmin配置mq的jndi。
下面是使用jmsadmin的一些命令的例子。
其实你可以去ibm的网站上面下载图形界面的东东,就不用记这些命令啦。
这个东东叫:JMSADMINGUI



def qcf(ivtQCF); 
def q(ivtQ); qu(SYSTEM.DEFAULT.LOCAL.QUEUE); 
def tcf(ivtTCF); 
def t(ivtT); topic(MQJMS/PSIVT/Information); 




或者你可以执行IVTSETUP脚本来完成一个可以使用的JNDI配置。

4、配置Weblogic的Foreign JMSServer以下属性进行配置:
JNDI Initial Context Factory->com.sun.jndi.fscontext.RefFSContextFactory 
JNDI Connection URL->file:/C:/JNDI-Directory     


5、配置Foreign JMS Connection Factories

代码:
Local JNDI Name:mqqcf(在weblogic 中使用的QueueConnectionFactory的JNDI的名字); 
Remote JNDI Name:ivtQCF(已经在通过jmsadmin配置好的jndi的名字); 


6、配置foreign JMS destination


Local JNDI Name: MQQUEUE 
Remote JNDI Name: ivtQ 
	


同上。
7、MDB配置




<?xml version="1.0"?> 
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> 
<!-- This ejb-jar.xml file defines a message-driven bean called "SimpleMDB". It uses container-managed transactions, because "transaction-type" is "Container" and "trans-attribute" is "Required". --> 
<ejb-jar> 
   <enterprise-beans> 
      <message-driven> 
         <ejb-name>ReceiveMessageMDB</ejb-name> 
         <ejb-class>com.rm.mdb.ReceiveMessageBean</ejb-class> 
         <transaction-type>Container</transaction-type> 
         <message-driven-destination> 
         <!-- In WebLogic Server 6.0, this next parameter is named "jms-destination-type" --> 
         <destination-type>javax.jms.Queue</destination-type> 
         </message-driven-destination> 
      </message-driven> 
   </enterprise-beans> 
   <assembly-descriptor> 
      <container-transaction> 
         <method> 
            <ejb-name>ReceiveMessageMDB</ejb-name> 
            <method-name>*</method-name> 
         </method> 
         <trans-attribute>NotSupported</trans-attribute> 
      </container-transaction> 
   </assembly-descriptor> 
</ejb-jar>	


<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'> 
<weblogic-ejb-jar> 
<weblogic-enterprise-bean> 
<ejb-name>ReceiveMessageMDB</ejb-name> 
<message-driven-descriptor> 
<pool> 
<max-beans-in-free-pool>8</max-beans-in-free-pool> 
<initial-beans-in-free-pool>1</initial-beans-in-free-pool> 
</pool> 
<destination-jndi-name>MQQUEUE</destination-jndi-name> 
<initial-context-factory> weblogic.jndi.WLInitialContextFactory </initial-context-factory> 
<provider-url>t3://localhost:7001</provider-url> 
<connection-factory-jndi-name>MQQCF</connection-factory-jndi-name> 
</message-driven-descriptor> 
</weblogic-enterprise-bean> 
</weblogic-ejb-jar> 
	


注意:
如果 ejb-jar.xml中的<trans-attribute>NotSupported</trans-attribute>
为required则需要使用XAQueueConnectionFactory.
分享到:
评论
1 楼 daquan198163 2008-05-22  
如果采用“JNDI Connection URL->file:/C:/JNDI-Directory ”这种配置,是不是意味着应用必须与mq server处在同一个服务器上

相关推荐

Global site tag (gtag.js) - Google Analytics