Configuring the Example MDB


You must make the following configuration changes to the WebLogic Server 8.1 to drive the example MDB using TIBCO Enterprise Message Service instead of WebLogic Server.

These steps are described in the following sections.

Adding TIBCO Enterprise Message Service to the WebLogic CLASSPATH

In the directory C:\bea\weblogic81\samples\domains\examples, modify the CLASSPATH environment variable in setExamplesEnv.cmd (the examples setup script.) and startExamplesServer.cmd (the start script).

On Windows platforms the extension for both of these files is .cmd; on UNIX platforms the extension is .sh.

Modify the CLASSPATH by adding this path to the end of its value list:

   C:\Tibco\ems\clients\java\tibjms.jar 

Creating Foreign JMSServer, JMSConnectionFactory, and JMSDestination in WebLogic

To create a foreign JMSServer, JMSConnectionFactory, and JMSDestination:

  1. Open a new command prompt window and change directory to: C:\bea\weblogic81\samples\domains\examples.
  2. Run the script startExamplesServer.cmd.
  3. When the WebLogic server completes startup, it will automatically point your default browser to the examples page. If it does not, start a web browser and load the page, http://<machineName>:7001/examplesWebApp/index.jsp.
  4. Click on the Administration Console link. Enter weblogic as the Username and Password and click Sign In.

  5. In the left pane, select examples->services->JMS->Foreign JMS Servers.
  6. In the right pane click the "Configure a new Foreign JMSServer..." link.
  7. Enter TIBCO JMSServer in the Name box, com.tibco.tibjms.naming.TibjmsInitialContextFactory in the JNDI Initial Context Factory box, and tibjmsnaming://localhost:7222 in the JNDI Connection URL box.
  8. Click Create and then click Apply.

  9. In the left pane, select examples->services->JMS->Foreign JMS Servers->TIBCO JMSServer->Foreign JMSConnectionFactories.
  10. In the right pane, click the "Configure a new Foreign JMSConnectionFactory..." link.
  11. Enter TIBCO JMSTopicConnectionFactory in the Name box, TIBCO.tcf in the Local JNDI Name box, and TopicConnectionFactory in the Remote JNDI Name box.
  12. Click Create and then click Apply.

  13. In the left pane, select examples->services->JMS->Foreign JMS Servers->TIBCO JMSServer->Foreign JMSDestinations.
  14. In the right pane, click the "Configure a new Foreign JMSDestination..." link.
  15. Enter TIBCO JMSTopic quotes in the Name box, TIBCO.quotes in the Local JNDI Name box, and quotes in the Remote JNDI Name box.
  16. Click Create and then click Apply.

Creating the Example MDB Destination Object Inside TIBCO EMS

To create the example MDB destination objects, perform the following:

  1. Start the TIBCO Enterprise Message Service server by selecting Start->Programs->TIBCO Enterprise Message Service 4.3->Start JMS Server from the Windows Start menu.
  2. Start the TIBCO Enterprise Message Service administration tool by selecting Start->Programs->TIBCO Enterprise Message Service 4.3->Start EMS Administration Tool from the Windows Start menu.
  3. Enter the following commands:
  4.    > connect 
       > create topic quotes 
    

Modifying the weblogic-ejb-jar.xml file for MDB

To use the appropriate JMSConnectionFactory and JMSDestination modify the file C:\bea\weblogic81\samples\server\examples\src\examples\ejb20\
message\weblogic-ejb-jar.xml
as follows:

  1. Replace the two instances of quotes in the <destination-jndi-name> element with TIBCO.quotes.
  2. Within the <message-driven-descriptor> element and immediately after both instances of the <destination-jndi-name> element, add the following element:
  3.    <connection-factory-jndi-name> 
          TIBCO.tcf 
       </connection-factory-jndi-name>  
    

Modifying the Client Program to Use TIBCO Enterprise Message Service JNDI

To use the JNDI provided by TIBCO Enterprise Message Service, the example MDB client program must be modified in three areas:

To modify the client source code:

The source file for the MDB client program is Client.java in the directory:

C:\bea\weblogic81\samples\server\examples\src\examples\ejb20\message 

Find and replace the following strings in the source file:

Find
Replace With...
weblogic.jms.ConnectionFactory
TopicConnectionFactory
weblogic.jndi.WLInitialContextFactory
com.tibco.tibjms.naming.TibjmsInitialContextFactory

There should be one occurrence of each of the above strings. When you are finished, save your changes.

To modify the build script to run the client:

The client program is run by executing the ant build script with a target of run. The build script passes the JNDI provider URL to the client program, and therefore it must be modified to pass the URL of TIBCO Enterprise Message Service JNDI. The file build.xml in the example MDB source directory contains the build script. Near the bottom of that file is the following line:

<arg value="t3://localhost:${PORT}"/> 

Modify that line as follows:

<arg value="tibjmsnaming://localhost:7222" /> 
To set the environment:

You have already added the tibjms.jar file to the CLASSPATH in a previous section. To set the environment, perform the following:

  1. Open a new command prompt window.
  2. Change directory to:
  3.    C:\bea\weblogic81\samples\domains\examples> 
    
  4. Enter the following command:
  5.    > setExamplesEnv 
     

    Verify that tibjms.jar is present when the script echoes the CLASSPATH.


TIBCO Enterprise Message Service™ Application Integration Guide
Software Release 4.3, February 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com