Copyright © TIBCO Software Inc. All Rights Reserved

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

> • | Add the TIBCO Enterprise Message Service JAR file to the CLASSPATH 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.

> • | Modify the client program to look up its administered objects from the built-in JNDI provider in TIBCO Enterprise Message Service.

> These steps are described in the following sections.
> Adding TIBCO Enterprise Message Service to the WebLogic CLASSPATH
> In the directory WebLogicHome\samples\domains\wl_server\examples, modify the CLASSPATH environment variable in setExamplesEnv.cmd (the examples setup script.).
> In the directory WebLogicHome\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\lib\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 6.0 > Start JMS Server from the Windows Start menu.

> 2. | Start the TIBCO Enterprise Message Service administration tool by selecting Start > Programs > TIBCO EMS 6.0 > Start EMS Administration Tool from the Windows Start menu.

> 3. | Enter the following commands:

> > 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:
> WebLogicHome\samples\server\examples\src\examples\ejb\ejb20\message
> where WebLogicHome is the WebLogic installation directory. For example, C:\bea\weblogic10.

> 1. | Add this import declaration to the top of the file:

> import weblogic.ejbgen.ForeignJmsProvider;

> 2. | Add these tags to the top of the file

> @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:

> • | the source code

> • | the build script

> • | the runtime environment i.e. the CLASSPATH

> To modify the client source code:
> The source file for the MDB client program is Client.java in the directory:
> WebLogicHome\samples\server\examples\src\examples\ejb\ejb20\message
> where WebLogicHome is the WebLogic installation directory. For example, C:\bea\weblogic10.

> 1. | Find and replace the following strings in the source file:

> Find | Replace With...
> weblogic.jms.ConnectionFactory | TopicConnectionFactory or TIBCO.tcf
> weblogic.jndi.WLInitialContextFactory | com.tibco.tibjms.naming.TibjmsInitial ContextFactory
> t3://localhost:7001 | tibjmsnaming://localhost:7222

> There should be one occurrence of each of the above strings.

> 2. | Change the line in constructor method to be (this line is right after getInitialContext() call):

> 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. | Open a new command prompt window.

> 2. | Change directory to:

> WebLogicHome\samples\domains\wl_server>
> where WebLogicHome is the WebLogic installation directory. For example, C:\bea\weblogic10.

> 3. | Enter the following command:

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

Copyright © TIBCO Software Inc. All Rights Reserved