Chapter 5 Integrating With WebLogic Server 10.0 : Configuring the Example MDB

Configuring the Example MDB
You must make the following configuration changes to the WebLogic Server 10.0 to drive the example MDB using TIBCO Enterprise Message Service instead of WebLogic Server.
Create the appropriate JMS Destination and connection factory objects inside the TIBCO Enterprise Message Service server using its administration tool.
Modify the MDB class file by adding JavaDoc annotations, to use the appropriate JMSConnectionFactory, JMSDestination, and JNDI Connection Factory when rebuilding and redeploying.
These steps are described in the following sections.
Adding TIBCO Enterprise Message Service to the WebLogic CLASSPATH
In the directory C:\bea\weblogic10\samples\domains\wl_server\examples, modify the CLASSPATH environment variable in setExamplesEnv.cmd (the examples setup script.).
In the directory C:\bea\weblogic10\samples\domains\wl_server\bin, modify the CLASSPATH variable in 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:
 
   EMS_HOME\jar\tibjms.jar
Creating the JMS Destination Object Inside TIBCO EMS
To create the JMS destination object and connection factory objects:
1.
Start the TIBCO Enterprise Message Service server by selecting Start > Programs > TIBCO EMS 5.1 > Start JMS Server from the Windows Start menu.
2.
Start the TIBCO Enterprise Message Service administration tool by selecting Start > Programs > TIBCO EMS 5.1 > Start EMS Administration Tool from the Windows Start menu.
3.
 
   > connect
   > create topic quotes
   > create jndiname TIBCO.quotes topic quotes
   > create factory TIBCO.tcf topic
   > create factory SSLTopicConnectionFactory topic
   > setprop factory SSLTopicConnectionFactory
      url=ssl://localhost:7243 ssl_verify_host=disable
Modifying the MDB Class File to Use TIBCO Enterprise Message Service Objects
You must modify the MessageTraderBean.java file in three ways. The MessageTraderBean.java file is located in:
C:\bea\weblogic10\samples\server\examples\src\examples\ejb\ejb20\message
1.
   import weblogic.ejbgen.ForeignJmsProvider;
2.
@ForeignJmsProvider(providerUrl="tibjmsnaming://localhost:7222",
       initialContextFactory="com.tibco.tibjms.naming.TibjmsInitialContextFactory",
       connectionFactoryJndiName="TIBCO.tcf")
3.
Modify the MessageDriven tag, so that the destinationJndiName property is TIBCO.quotes, and the transactionType property is BEAN driven. For example:
@MessageDriven(maxBeansInFreePool = "200",
              destinationType = "javax.jms.Topic",
              initialBeansInFreePool = "20",
              transTimeoutSeconds = "0",
              defaultTransaction = MessageDriven.DefaultTransaction.NOT_SUPPORTED,
              transactionType = MessageDriven.MessageDrivenTransactionType.BEAN,
              durable = Constants.Bool.FALSE,
              ejbName = "messageDriven",
              destinationJndiName = "TIBCO.quotes",
              acknowledgeMode = MessageDriven.AcknowledgeMode.DUPS_OK_ACKNOWLEDGE)
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\weblogic10\samples\server\examples\src\examples\ejb\ejb20\message
1.
There should be one occurrence of each of the above strings.
2.
TopicConnectionFactory cf = (TopicConnectionFactory) m_context.lookup("TIBCO.tcf");
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://${wls.home}:${wls.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.
2.
   C:\bea\weblogic10\samples\domains\wl_server>
3.
   > setExamplesEnv
Verify that tibjms.jar is present when the script echoes the CLASSPATH.