The following section provides the information required to integrate and run UserTransactions using Oracle 9i and Weblogic 7.0 Application servers.
Integrating with WebLogic 7.0 Application Server
- Execute the following steps to integrate Fiorano's XAResource with the Weblogic 7.0 Application server:
- Extract the files present in weblogic_fiorano.zip to a separate folder (UNZIP_DIR). This folder contains all the files required to perform the steps listed below:
- Install Weblogic Platform 7.0.1.0
- Copy "%FMQ_DIR%\lib\client\all\fmq-client.jar" to "%WL_HOME%\server\lib".
- Include the file, %UNZIP_DIR%\fiorano.zip,%WL_HOME%\server\lib\fmq-client.jar in the classpath of %WL_HOME%\samples\server\config\examples\setExamplesEnv.cmd and %WL_HOME%\server\bin\startWLS. This fiorano.zip file contains the wrapper classes used for the interception of calls made by the application server.
- Navigate to the folder %WL_HOME%\samples\server\src\examples\ejb20\message and copy the files MessageTraderBean.java, Client.java, ejb-jar.xml and weblogic-ejb-jar.xml extracted from the file WeblogicIntegration.zip, which can be found in %UNZIP_DIR%.
- Run %WL_HOME%\samples\server\config\examples\setExamplesEnv.cmd on the DOS prompt. This provides the environment required for running the sample.
- Navigate to the folder %WL_HOME%\samples\server\src\examples\ejb20\message using the aforementioned DOS prompt and execute the file build.cmd present in the zip file WeblogicIntegration.zip, which can be found in %UNZIP_DIR%. This compiles the file Client.java and adds it to the folder %WL_HOME%\samples\server\stage\examples\clientclasses\ examples\ejb20\message since the package of Client.java is examples.ejb23.message. In addition this rebuilds ejb20_message.jar and adds it to the folder %WL_HOME%\samples\server\config\examples\applications.
- Include the FioranoWeblogicMapper in the weblogicstartup.
The FioranoWeblogicMapper class maps the JNDI objects in the FioranoMQ name space(XA enabled connectionfactories, XA enabled Queues, and XA enabled Topics) and binds them to objects in the Weblogic JNDI. These objects can be looked up using Weblogic's InitialContext in the following manner:
Ictx.lookup("fiorano_wl_PRIMARYXAQCF") etc..
The FioranoWeblogicMapper maps the FioranoMQ administered objects to the Weblogic Naming tree in a manner that allows primaryXAQCF in FioranoMQ's JNDI to be mapped onto fiorano_wl_PrimaryXAQCF in Weblogic's JNDI. - Copy the attached FioranoWeblogicMapper.zip to the classpath set in the startExamplesServer (or startWLS.cmd) file
- Open the Weblogic adminConsole. Select deployments\startup and shutdown.
- Select configure a new Startup class. Under the configuration tab, specify the following:
- Name FioranoWeblogicMapper
- ClassName FioranoWeblogicMapper
- Deployment order 0
- Arguments None
- Start the FioranoMQ server (with XA enabled). Navigate to the folder %WL_HOME%\server\bin and start the Oracle Weblogic Application server by executing the batch file:
startWLS.cmd
The bean is deployed on the Oracle Weblogic Application server. It is a message driven bean listening on primaryTopic. - Use a normal publisher (run-client Publisher) to publish a message on a primaryTopic. The onMessage of the bean is invoked, which in turn calls the transact() method of the MDB.
transact() method
performs the following steps:- Looks up XA Queue Connection Factory.
- Starts the usertransaction.
- Sends a message on the primaryRDBMSQueue.
- Commits the userTransaction.
- Add fiorano.zip to the classpath of build.cmd.
- To compile the samples, execute: run build.cmd
Integrating with Oracle 9i Application Server
Perform the following steps to integrate Fiorano's XAResource with the Oracle 9i Application server:
- Unzip the Uorion_fiorano.zip fileU, which contains the files required to run the sample discussed in this section.
- Unzip and add classes to fmq-client.jar found in the %FMQ_HOME%\fmq\lib\client\all directory to the ORACLE_HOME\j2ee\home\oc4j.jar file.
- Replace server.xml located in OC4J_HOME\config with the one found in orion_fiorano.zip file. If your server.xml file has any applications deployed add the tag below to the application-server tag of server.xml, instead of replacing the file. <application name="FMQ samples" path="../demo/fmq"/>
- Unzip the file fmq_bean.zip (also found in the orion_fiorano.zip file mentioned above), located in the /demo directory of OC4J_HOME directory. This creates a folder called fmq in the /demo dir with the java and class files TestJmsXaClient, TestJmsXa.java, TestJmsXaRemote.java, and TestJmsXaHome.
- Change the ORACLE database ConnectionParameters (URL, username, password) in the file TestJmsXa.java in keeping with the Oracle installation and recompile the file. The files ejb.jar, jaas.jar, and oc4j.jar must be in the classpath when compiling and running the files.
- Replace the file CMTQueueSession.class with the attached CMTQueueSession.class in the oc4j.jar file. Extract the CMTQueueSession.class file from orion_fiorano.zip file. Make sure that the package structure of this file remains intact while replacing the class in the oc4j.jar file. (The package is com.evermind.server.jms.CMTQueueSession.class).
- Start OC4J. OC4J deploys the application called FioranoMQ Samples and the bean TestJmsXa with it. If the bean is deployed successfully the output should be:
Auto-deploying FMQ samples (Assembly had been updated)...
Auto-deploying test (Class 'TestJmsXaRemote' had been updated)... - Start the FioranoMQ server and a JMS QueueReceiver that is receiving messages on primary RDBMSQueue.
- Run the client to the bean, TestJmsXaClient (run_oracle TestJmsXaClient). In the client, the map() method of the bean is called and this maps the FioranoMQ XA enabled connectionfactories to the oracle9i JNDI.
- The client invokes the transact method in which a UserTransaction object is received. The UserTransaction is started, after which a message is sent to the FioranoMQ primaryRDBMSQueue. Following this message the user transaction is committed. The QueueReceiver receives the message only when the usertransaction is committed.