weblogic:8.1 SP2
mq:5.3
Absrtact: Integrating WebLogic with MQ is a valuable application. This article discusses the use of WebLogic's foreign JMS Server configuration Jndi,mdb configuration, which is provided using MQ
Jmsadmin configures MQ Jndi. Also not so detailed, or need the reader to make a small effort.
Key words: jms,weblogic foreign JMS Server,jndi,jmsadmin
Begin:
1, install WebLogic and MQ (nonsense).
2. Configure Jmsadmin (that is, files with no extensions in the java/bin/directory under the MQ installation directory)
Uncomment the next two lines and build the corresponding directory on your machine c:/jndi-directory
Java code: |
Initial_context_factory=com. Sun. Jndi. Fscontext. Reffscontextfactory
Provider_url=file:/c:/jndi-directory
|
The above configuration is appropriate for using file Jndi.
3, configure the MQ Jndi
The following uses Jmsadmin to configure MQ Jndi.
Here are some examples of commands that use Jmsadmin.
In fact, you can go to IBM's website to download the graphics interface, you do not have to remember these commands.
This dongdong is called: Jmsadmingui
Java code: |
def QCF (IVTQCF) def q (IVTQ) Qu (SYSTEM. DEFAULT. Local. QUEUE) def TCF (IVTTCF) def t (IVTT) topic (mqjms/psivt/information)
|
Or you can execute a ivtsetup script to complete a JNDI configuration that you can use.
4, configure the WebLogic foreign jmsserver the following properties to configure:
Java code: |
JNDI Initial context factory->com. Sun. Jndi. Fscontext. Reffscontextfactory JNDI Connection Url->file:/c:/jndi-directory
|
5. Configure Foreign JMS Connection factories
Code:
Java code: |
Local Jndi NAME:MQQCF (name of the JNDI queueconnectionfactory used in WebLogic) Remote JNDI NAME:IVTQCF (already in the name of º Mei Äjndi configured via Jmsadmin)
|
6. Configure Foreign JMS destination
Java code: |
Local JNDI Name:mqqueue Remote JNDI NAME:IVTQ
|
Ditto.
7. MDB configuration
Java code: |
<?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 code: |
<?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>
|
Attention:
If the <trans-attribute>NotSupported</trans-attribute> in Ejb-jar.xml
For required, you need to use xaqueueconnectionfactory.