轻松

记述我学习java的里程

常用链接

统计

积分与排名

友情链接

最新评论

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


java代码: 



INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory

PROVIDER_URL=file:/C:/JNDI-Directory   




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


java代码: 



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以下属性进行配置:
java代码: 


JNDI Initial Context Factory->com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL->file:/C:/JNDI-Directory     



5、配置Foreign JMS Connection Factories

代码:
java代码: 


Local JNDI Name:mqqcf(在weblogic 中使用的QueueConnectionFactory的JNDI的名字)
Remote JNDI Name:ivtQCF(已经在通过jmsadmin配置º玫Äjndi的名字)



6、配置foreign JMS destination

java代码: 



Local JNDI Name: MQQUEUE
Remote JNDI Name: ivtQ
       



同上。
7、MDB配置



java代码: 



<?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>       



java代码: 


<?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.

posted on 2006-03-07 11:51 轻松 阅读(3365) 评论(1)  编辑  收藏 所属分类: JAVA转贴

评论

# seo対策 2007-09-21 09:57 seo対策

多数のサイトと簡単にリンク交換が可能、アクセスアップとSEO対策を支援する自動相互リンクサービス相互リンクを増やそうと思う方へ 単なるリンクの数のみではなく、リンクの質も念頭に置いてください。  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: