Contents

The following section provides the information required to integrate and run UserTransactions using Oracle 9i and Weblogic 7.0 Application servers.

23.8.1 Integrating with WebLogic 7.0 Application Server

  1. Execute the following steps to integrate Fiorano's XAResource with the Weblogic 7.0 Application server:
  2. 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:
  3. Install Weblogic Platform 7.0.1.0
  4. Copy "%FMQ_DIR%\lib\client\all\fmq-client.jar" to "%WL_HOME%\server\lib".
  5. 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.
  6. 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%.
  7. Run %WL_HOME%\samples\server\config\examples\setExamplesEnv.cmd on the DOS prompt. This provides the environment required for running the sample.
  8. 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.
  9. 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.

  10. Copy the attached FioranoWeblogicMapper.zip to the classpath set in the startExamplesServer (or startWLS.cmd) file
  11. Open the Weblogic adminConsole. Select deployments\startup and shutdown.
  12. Select configure a new Startup class. Under the configuration tab, specify the following:
    • Name FioranoWeblogicMapper
    • ClassName FioranoWeblogicMapper
    • Deployment order 0
    • Arguments None
  13. 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.

     
  14. 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:
      1. Looks up XA Queue Connection Factory.
      2. Starts the usertransaction.
      3. Sends a message on the primaryRDBMSQueue.
      4. Commits the userTransaction.
    Icon

    A receiver on primaryRDBMSTopic receives the message only when theusertransactionis committed. (Similar tests can be performed forut.rollback() and other methods.)

  15. Add fiorano.zip to the classpath of build.cmd.
  16. To compile the samples, execute: run build.cmd

23.8.2 Integrating with Oracle 9i Application Server

Perform the following steps to integrate Fiorano's XAResource with the Oracle 9i Application server:

  1. Unzip the Uorion_fiorano.zip fileU, which contains the files required to run the sample discussed in this section.
  2. 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.
  3. 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"/>
  4. 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.
  5. 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.
  6. 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).
  7. 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)... 
  8. Start the FioranoMQ server and a JMS QueueReceiver that is receiving messages on primary RDBMSQueue.
  9. 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.
  10. 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.
Adaptavist ThemeBuilder EngineAtlassian Confluence