deployment and integration guide 2-0

Upload: eugenioenr

Post on 29-May-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Deployment and Integration Guide 2-0

    1/50

    MantaRay

    Deployment and

    Integration GuideNext Generation Distributed MessagingVersion 2.0 (DOC 2.0.0.)

    Coridan Inc.

  • 8/9/2019 Deployment and Integration Guide 2-0

    2/50

  • 8/9/2019 Deployment and Integration Guide 2-0

    3/50

    Copyright Notice 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) iii

    Copyright Notice

    Copyright 2006 Coridan Inc.

    All rights reserved.

    This document contains proprietary information of Coridan Inc., and is provided under a

    license agreement containing restrictions on use and disclosure and is also protected by

    copyright law.

    Due to continued product development this information may change without notice. The

    information and intellectual property contained herein is confidential between Coridan

    Inc. and the client and remains the exclusive property of Coridan Inc. If you find any

    problems in the documentation, please report them to us in writing. Coridan does not

    warrant that this document is error-free.

    No part of this publication may be reproduced, stored in a retrieval system, or

    transmitted in any form or by any means, electronic, mechanical, photocopying,recording or otherwise without the prior written permission of Coridan.

    Microsoft Word, Microsoft Office, Windows and Windows XP are trademarks of the

    Microsoft Corporation. Java is a trademark of the Sun Corporation. MantaRay is a

    registered trademark of Coridan Inc.

    Coridan Inc.Boston, MA, USA

    +(866) 808-0322

    Support E-Mail: (mailto:[email protected])

    Website: (http://www.coridan.com)

    mailto:[email protected]://www.coridan.com/http://www.coridan.com/mailto:[email protected]
  • 8/9/2019 Deployment and Integration Guide 2-0

    4/50

    11 May 2006

    iv Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Table of Contents

    Copyright Notice ii i

    Table of Contents iv

    Preface v

    About this Manual ........................................................... .............................................................. ...............vAudience............................................................................................................................................ vMantaRay Documentation.................................................................................................................vDocument Conventions ............................................................... .....................................................vi

    About Coridan .............................................................. .................................................................. ........... viiWorldwide Technical Support ....................................................................... ............................................ vii

    Feature Requests............................................................................................................................ viii

    Bug Reports................................................................................................................................... viiiJBoss Versions 3.x and 4.x 1

    JBoss Configuration Process .......................................................................... ..............................................1Specifying the Location of MantaRay Files ................................................................. .....................2Registering MantaRay JMS objects in the JNDI Tree.......................................................................3Configuring MantaRay as a Foreign JMS Provider...........................................................................4

    Code Samples .............................................................. ................................................................... ..............6Servlet Context Listener Class Sample Code ........................................................................... .........6Web.xml Sample File .............................................................. ..........................................................7JBoss Startup Destination MBean Interface ........................................................................... ...........7JBoss Startup Destination MBean Implementation ................................................................... ........8

    WebLogic 8.1 11WebLogic 8.1 Configuration Process................. ............................................................................ ............11

    Specifying the Location of MantaRay Files ................................................................. ...................11Registering MantaRay JMS objects in the JNDI Tree.....................................................................13Running the WebLogic Server ................................................................ ........................................14Verifying the JNDI Tree..................................................................................................................14Configuring MantaRay as a Foreign JMS Provider.........................................................................15

    Code Samples .............................................................. ................................................................... ............19Servlet Context Listener Class Sample Code ........................................................................... .......19Web.xml Sample File .............................................................. ........................................................19Config.xml Sample File...................................................................................................................20Startup Class Sample Code..............................................................................................................21

    WebLogic 9.x 23WebLogic 9.x Configuration Process................. ............................................................................ ............24

    Specifying the Location of MantaRay Files ................................................................. ...................24Running the WebLogic Server ................................................................ ........................................25Registering MantaRay JMS objects in the JNDI Tree.....................................................................25Configuring MantaRay as a Foreign JMS Provider.........................................................................30

    Code Samples .............................................................. ................................................................... ............40Servlet Context Listener Class Sample Code ........................................................................... .......40Web.xml Sample File .............................................................. ........................................................41Startup Class Sample Code..............................................................................................................42

  • 8/9/2019 Deployment and Integration Guide 2-0

    5/50

    Preface 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) v

    Preface

    In This ChapterAbout this Manual .......................................................v

    About Coridan .............................................................viiWorldwide Technical Support .....................................vii

    About this Manual

    This guide presents techniques and procedures for deploying MantaRay messaging

    solutions in enterprise environments. Incorporation into a variety of commercial business

    integration and enterprise backbone solutions is the principal focus of this document.

    These solutions include SOA and ESB based products.

    Each chapter covers a specific product or product line. The material includes explanatorytext, step-by-step procedure and code samples for your use.

    Audience

    The Deployment and Integration guide is intended for use by developers, system

    architects and integrators involved in the process of deploying enterprise infrastructure

    solutions. The reader is expected to be familiar with Java programming, JMS and the

    concepts of distributed enterprise environments.

    MantaRay Documentation

    Documentation for the MantaRay solutions consists of several user guides available in

    PDF format. The Coridan web site (http://www.coridan.com) contains application

    samples and a variety of other useful information.

    Getting Started Guide

    The Getting Started Guide provides a brief overview of the MantaRay peer-to-peermessaging solution, along with step-by-step instructions for installation and basic

    configuration. This volume also includes instructions for verifying and testing the

    installation through the use of simple application samples.

    Reference Guide

    The Reference Guide contains a technical overview together with detailedinstructions and explanations regarding configuration parameters, options, advanced

    features, and API documentation. This information is presented in a handy tabular

    format designed for easy reference without the necessity of paging through a lengthy

    book.

    http://www.coridan.com/http://www.coridan.com/
  • 8/9/2019 Deployment and Integration Guide 2-0

    6/50

    11 May 2006 About this Manual

    vi Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Document Conventions

    The following table shows the typographic conventions used for this book.

    Typeface Description

    Terms Emphasizes specific terms and concepts, generallywhen first introduced

    Code Sample Code samples and configuration file text

    Note Notes, tips, cautions and warningsCommand Commands or text to be entered

    Parameter Parameter name

    OPTION Menu or dialog option

    The following table shows the icons that are used to draw attention to specific topics in

    this book.

    Icon Description

    Tips - Tips, tricks, work-arounds and other good ideas to

    help you work more efficiently

    Caution - Pay careful attention to the instructions in order to

    avoid errors or unexpected results

    Warning - Failure to follow the instructions will result in anerror or system instability

    Notes - Informative information

    Java code sample

    XML code segment or file

  • 8/9/2019 Deployment and Integration Guide 2-0

    7/50

    Preface 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) vii

    About Coridan

    Coridan is a leading provider of peer-to-peer messaging middleware products that

    provide cutting-edge alternatives to traditional messaging solutions. Located in Boston,

    Massachusetts, USA and Herzliya, Israel, Coridan was founded in 2003.

    The Coridan team includes high tech veterans with many years of experience in

    developing world-class software products. Coridan is backed by leading institutional

    venture capital firms that take a hands-on approach in nurturing promising high-tech

    companies.

    Worldwide Technical Support

    At Coridan, we provide first class support for all of our products and technologies via

    our web site (http://www.coridan.com). As an open source project, MantaRay benefits

    from the support of thousands of developers worldwide who provide constant feedback,

    inquiries, bug reports, fixes, work-arounds and feature requests. This information and

    more is available at the MantaRay Project website

    (http://sourceforge.net/projects/mantaray/).

    You are invited to take advantage of our technical support facilities as described below:

    E-mail support is available on a 24/7 basis Demos (http://www.coridan.com) are available for download from our web site A help forum (http://sourceforge.net/forum/?group_id=112623) is available at the

    MantaRay Project site at SourceForge

    MantaRay developer blogs are available on our web site Sign up for our e-mail list to receive up-to-date information regarding new releases,

    bug fixes, upcoming events, seminars, webinars, etc.

    When contacting technical support, please supply the following information, when

    possible:

    Your name and contact information Your company or organization Product version number and build Platform and operating system information:

    - Hardware description- Operating system and version- Available memory- Description of messaging scenario and requirements- Firewalls and other network security software

    Problem description and any documentation that may help in resolving the problem,such as log files and descriptions of the testing scenario

    http://www.coridan.com/http://sourceforge.net/projects/mantaray/http://www.coridan.com/http://sourceforge.net/forum/?group_id=112623http://sourceforge.net/forum/?group_id=112623http://www.coridan.com/http://sourceforge.net/projects/mantaray/http://www.coridan.com/
  • 8/9/2019 Deployment and Integration Guide 2-0

    8/50

    11 May 2006 Worldwide Technical Support

    viii Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Feature Requests

    If you have a feature request, please submit it at

    MantaRay: Feature Requests: Submit Tracker Item

    (https://sourceforge.net/tracker/?func=add&group_id=112623&atid=663826).

    Bug Reports

    Submit a bug report on the

    MantaRay: Bugs: Submit Tracker Item

    (http://sourceforge.net/tracker/?func=add&group_id=112623&atid=663823)

    page at SourceForge.net.

    When submitting a bug report, please supply the information requested above for

    technical support.

    https://sourceforge.net/tracker/?func=add&group_id=112623&atid=663826http://sourceforge.net/tracker/?func=add&group_id=112623&atid=663823http://sourceforge.net/tracker/?func=add&group_id=112623&atid=663823https://sourceforge.net/tracker/?func=add&group_id=112623&atid=663826
  • 8/9/2019 Deployment and Integration Guide 2-0

    9/50

    JBoss Versions 3.x and 4.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 1

    JBoss Versions 3.x and 4.x

    In This ChapterJBoss Configuration Process .......................................1

    Code Samples ..............................................................6

    This chapter presents the procedures for configuring JBoss Application Server versions

    3.x and 4.x.so that MantaRay functions as a foreign JMS provider in this environment.

    The explanations and procedures contained in this chapter assume that you have

    successfully installed, configured and integrated JBoss Application Server into your IT

    environment and that you are familiar with its operational concepts and procedures. For

    further information, please refer to the JBoss documentation.

    This chapter further assumes that you have successfully installed and configured

    MantaRay on the Application Server peer(s) and any client peers requiring MantaRaymessaging capability. For details and instructions regarding installing and configuring

    MantaRay, please refer to the MantaRay Getting Started and Reference Guides.

    Notes: The following text expressions, appearing in this chapter, refer to specific file

    locations in instructions and code samples as specified below. When following the

    instructions or writing code, you should substitute the actual locations for these

    expressions.

    JBOSS_HOME refers to the fully qualified path to the folder in which the JBoss Server

    files are located.

    MANTA_HOME refers to the fully qualified path to the MantaRay installation folder.

    JBoss Configuration Process

    The JBoss configuration process consists of three sequential procedures:

    1 Specifying the location of MantaRay files

    2 Registering MantaRay JMS objects in the JNDI tree

    3 Configuring MantaRay as a Foreign JMS Provider

    Each of these steps is described in detail in the following sections.

    1

  • 8/9/2019 Deployment and Integration Guide 2-0

    10/50

    11 May 2006 JBoss Configuration Process

    2 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Specifying the Location of MantaRay Files

    In order for JBoss to work with MantaRay, you need to specify the location of the

    MantaRay JAR files and the MantaRay configuration file.

    MantaRay JAR Files

    To specify the location of the MantaRay JAR files, perform either of the following

    steps:

    Copy the Manta.jar and all jar files from the Manta/ext folder into theJBOSS_HOME\server\default\lib folder.

    Manually add the MantaRay class path to the JBoss startup script (run.bat forWindows orrun.shfor Unix/Linux), located under the JBOSS_HOME\binfolder.

    JAR files (add other relevant JAR files as required)

    set MANTA_PATH="%MANTA_HOME%\\antlr.jar;%MANTA_HOME%\manta.jar;

    %MANTA_HOME%\ext\clink-1.5.0.jar;%MANTA_HOME%\ext\commons-logging.jar;%MANTA_HOME%\ext\jms.jar;%MANTA_HOME%\ext\log4j-1.2.8.jar;%MANTA_HOME%\ext\jmxri.jar;%MANTA_HOME%\ext\jmxremote.jar;%MANTA_HOME%\ext\jmxtools.jar;"

    MANTA_PATH

    set JBOSS_CLASSPATH = %JBOSS_CLASSPATH%;%MANTA_PATH%

    The mantaConfig JVM property

    The mantaConfig property is a required JVM parameter that specifies the location of the

    MantaRay configuration file. To set the mantaConfig property, perform any one of the

    following steps:

    Specify the path to the MantaRay configuration files in the Servlet context listenercode.

    Specify the path to the MantaRay configuration files in the JBoss specific startupclass code.

    Specify the path to the MantaRay configuration files in the JBoss startup script(run.bat for Windows or run.sh for Unix/Linux), located under the

    JBOSS_HOME\bin folder. Add the following line:

    Set JAVA_OPTS=%JAVA_OPTS% -DmantaConfig=%MANTA_CONFIG\config\default_config.xml

  • 8/9/2019 Deployment and Integration Guide 2-0

    11/50

    JBoss Versions 3.x and 4.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 3

    Registering MantaRay JMS objects in the JNDI Tree

    You must register the MantaRay JMS objects (ConnectionFactories, Queues, and

    Topics) in the server JNDI tree.

    There are two methods for registering the MantaRay JMS objects into the JNDI tree:

    Register objects at startup by using a Servlet context listener. This is the standard(and preferred) method, which works well with any J2EE compliant server without

    the need for any server-specific API.

    Register objects using a JBoss startup class.The following procedures describe both methods.

    To Deploy a Startup Class Using a Servlet Context Lis tener

    1 Create a Servlet context listener class (See "Servlet Context Listener Class SampleCode" page 6).

    2 Create a web.xml (See "Web.xml Sample File" page 7) file that refers to the listener

    class.3 Pack the class and the web.xml file into a WAR file with the following basic

    structure:

    WEB-INF/ - folder for application supportlib/ - folder for supporting jar filesclasses/ - folder for compiled java filesweb.xml - configuration file for the application

    4 Move the WAR file to the JBOSS_HOME\server\default\deploy folder.

    To Register MantaRay Objects Using a JBoss Startup Class

    1 Create a startup MBean that holds the MantaRay destinations and binds them intothe JNDI tree. The MBean is comprised of two files, the MBean interface (See

    "JBoss Startup Destination MBean Interface" page 7) and the MBeanimplementation (See "JBoss Startup Destination MBean Implementation" page 8).

    2 Generate a JBoss SAR file:

    a Compile the MantaRay startup class and interface.

    b Create a jboss-service.xml file in the META-INF folder, containing thefollowing lines:

    c Pack the compiled class and interface with the jboss-service.xml file intoa JAR file (for example, manta-startup.jar) with the following basicstructure:

    META-INFjboss-service.xml

    MantaStartupMBean.classMantaStartup.class

    d Change the file extension from .jar to.sar (for example, manta-startup.sar).

    3 Move the SAR file to the JBOSS_HOME\server\default\deploy folder.

  • 8/9/2019 Deployment and Integration Guide 2-0

    12/50

    11 May 2006 JBoss Configuration Process

    4 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Configuring MantaRay as a Foreign JMS Provider

    Once you have completed registering the MantaRay JMS objects in the JNDI tree, you

    can use MantaRay as a JMS server using a regular JMS client in either environment.

    However, in order to consume JMS messages more efficiently, you should also register

    MantaRay as a foreign JMS provider in JBoss.

    To register the MantaRay JMS server as a Foreign JMS provider:

    1 Set the RecursiveSearch attribute to 'True ' in the, located in theJBOSS_HOME\server\default\conf folder.

    True

    2 Insert the following code into the tag in thejboss-service.xml file:

    Manta-message-driven-bean

    JBoss.mq:service=JMSProviderLoader,name=MantaJMSProviderorg.jboss.ejb.plugins.jms.JMSContainerInvoker

    MantaMQStdJMSPool130000151

    10

    queue/DLQ

    100

    3 Insert the following code into the tag:

  • 8/9/2019 Deployment and Integration Guide 2-0

    13/50

    JBoss Versions 3.x and 4.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 5

    Manta MDB supporttrueManta-message-driven-bean

    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor

    org.jboss.ejb.plugins.LogInterceptororg.jboss.ejb.plugins.RunAsSecurityInterceptor

    org.jboss.ejb.plugins.TxInterceptorCMT

    org.jboss.ejb.plugins.MetricsInterceptor

    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor

    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor

    org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT

    org.jboss.ejb.plugins.MetricsInterceptor

    org.jboss.resource.connectionmanager.CachedConnectionInterceptor

    org.jboss.ejb.plugins.MessageDrivenInstancePool

    100

    4 Add the following MBean descriptor to the jms-ds.xml file, located in theJBOSS_HOME\server\default\deploy\jms folder. This code should benested in the tag.

    MantaMQ

    org.jboss.jms.jndi.JNDIProviderAdaptermantaQCFmantaTCF

  • 8/9/2019 Deployment and Integration Guide 2-0

    14/50

    11 May 2006 Code Samples

    6 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Code Samples

    This section presents several examples of code that illustrate the concepts and

    configuration procedures. Explanatory notes are appended to some of the samples.

    Servlet Context Listener Class Sample Code

    package com.manta.sample.startup

    import org.mr.api.jms.*;import javax.jms.*;import javax.naming.InitialContext;import javax.naming.InitialContext;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContextListener;

    public class MantaStartup implements ServletContextListener {public MantaStartup() {super();}public void contextInitialized(ServletContextEvent sce) {

    try {//create connection factory objectsQueueConnectionFactory qFactory =

    new MantaQueueConnectionFactory();TopicConnectionFactory tFactory =

    new MantaTopicConnectionFactory();//initiate JNDI context//bind the connection factorie objects to the//JNDI treecontext.bind("mantaQCF", qFactory);System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");TopicConnection tcon =

    tFactory.createTopicConnection();QueueConnection qcon =

    qFactory.createQueueConnection();QueueSession qsess = qcon.createQueueSession(false,

    Session.AUTO_ACKNOWLEDGE);TopicSession tsess = tcon.createTopicSession(false,

    Session.AUTO_ACKNOWLEDGE);//bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);

    //bind topic to the JNDI treeString qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);

    context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();

    }catch (Exception e) { e.printStackTrace();}}public void contextDestroyed(ServletContextEvent sce) {}

    Code Sample Notes

    Modify JMS destinations as required by your applications. The MantaRayQueueConnectionFactory and

    MantaRayTopicConnectionFactory bindings are mandatory.

    We recommend that you use a configuration file to load destinations and connectionfactories in your code. This example uses hard-coded values for demonstration

    purposes only

  • 8/9/2019 Deployment and Integration Guide 2-0

    15/50

    JBoss Versions 3.x and 4.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 7

    Web.xml Sample File

    com.manta.sample.startup.MantaStartup

    JBoss Startup Destination MBean Interface

    public interface MantaStartupMBean {public abstract void init() throws Exception;public abstract void start() throws Exception;public abstract void stop() throws Exception;public abstract void destroy() throws Exception;

    }

  • 8/9/2019 Deployment and Integration Guide 2-0

    16/50

    11 May 2006 Code Samples

    8 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    JBoss Startup Destination MBean Implementation

    import org.jboss.util.*;import javax.management.*;import org.mr.api.jms.*;import javax.naming.*;import javax.jms.*;

    public class MantaStartup implements MBeanRegistration,MantaStartupMBean {

    public MantaStartup() {}public ObjectName preRegister(MBeanServer server, ObjectName

    name)throws java.lang.Exception {return new ObjectName(":service=MantaStartup");

    }public void postRegister(java.lang.Boolean registrationDone){}public void preDeregister() throws java.lang.Exception {}public void postDeregister() {}public void init() throws Exception {}public void start() throws Exception {try {

    //create connection factory objects

    QueueConnectionFactory qfactory =new MantaQueueConnectionFactory();

    TopicConnectionFactory tFactory =new MantaTopicConnectionFactory();

    ConnectionFactory mfactory =new MantaConnectionFactory();

    //initiate JNDI contextInitialContext context = new InitialContext();//bind the connection factorie objects to the//JNDI treecontext.bind("mantaCF", mfactory);System.out.println("bind mantaCF");context.bind("mantaQCF", qfactory);System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");

    TopicConnection tcon =tFactory.createTopicConnection();

    QueueConnection qcon =qfactory.createQueueConnection();

    QueueSession qsess = qcon.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

    TopicSession tsess = tcon.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);

    //bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);//bind topic to the JNDI treeString qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();} catch (Exception e) { e.printStackTrace();}

    }public void stop() throws Exception {

    //write custom code here to do implement any cleanup functionality}public void destroy() throws Exception {}

    }

  • 8/9/2019 Deployment and Integration Guide 2-0

    17/50

    JBoss Versions 3.x and 4.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 9

    Code Sample Notes

    Modify destinations as required by your applications. The MantaRayQueueConnectionFactory and

    MantaRayTopicConnectionFactory bindings are mandatory.

    We recommend that you use a configuration file to load destinations and connectionfactories. This example uses hard-coded values for demonstration purposes only.

  • 8/9/2019 Deployment and Integration Guide 2-0

    18/50

  • 8/9/2019 Deployment and Integration Guide 2-0

    19/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 11

    WebLogic 8.1

    In This ChapterWebLogic 8.1 Configuration Process ..........................11

    Code Samples ..............................................................19

    This chapter presents the procedures for configuring WebLogic version 8.1 so that

    MantaRay functions as a foreign JMS provider in this environment. The explanations

    and procedures contained in this chapter assume that you have successfully installed,

    configured and integrated WebLogic into your IT environment and that you are familiar

    with its operational concepts and procedures. For further information, please refer to the

    WebLogic documentation.

    The data displayed in the screen captures is for example purposes only. You should

    define object names and attributes for your environment according to your specificrequirements.

    This chapter further assumes that you have successfully installed and configured

    MantaRay on the server peer(s) and any client peers requiring MantaRay messaging

    capability. For details and instructions regarding installing and configuring MantaRay,

    please refer to the MantaRay Getting Started and Reference Guides.

    Notes: The following text expression, appearing in this chapter, refers to a specific file

    location in instructions and code samples as specified below. When following the

    instructions or writing code, you should substitute the actual location for this expression.

    MANTA_HOME refers to the fully qualified path to the MantaRay installation folder.

    WebLogic 8.1 Configuration Process

    The WebLogic configuration process consists of three sequential procedures:

    1 Specifying the location of MantaRay files

    2 Registering MantaRay JMS objects in the JNDI tree

    3 Configuring MantaRay as a Foreign JMS Provider

    Each of these steps is described in detail in the following sections.

    Specifying the Location of MantaRay Files

    In order for WebLogic to work properly with MantaRay, you need to specify the location

    of the MantaRay JAR files and the MantaRay configuration file.

    To configure WebLogic to locate the MantaRay JAR files:

    1 Manually add the MantaRay class path to the startWebLogic.cmd (Windows)or startWebLogic.sh (Unix/Linux) file. Add any additional lines that may berequired in your environment.

    2

  • 8/9/2019 Deployment and Integration Guide 2-0

    20/50

    11 May 2006 WebLogic 8.1 Configuration Process

    12 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    set MANTA_PATH="%MANTA_HOME%\ext\antlr.jar;%MANTA_HOME%\manta.jar;%MANTA_HOME%\ext\clink-1.5.0.jar;%MANTA_HOME%\ext\commons-logging.jar;%MANTA_HOME%\ext\jms.jar;%MANTA_HOME%\ext\log4j-1.2.8.jar;%MANTA_HOME%\ext\jmxri.jar;%MANTA_HOME%\ext\jmxremote-jmx.jar;

    %MANTA_HOME%\ext\jmxtools.jar;"2 Add the MANTA_PATH to the class path.

    set CLASSPATH= %CLASSPATH%; %MANTA_PATH%

    Warning: Make certain that the %CLASSPATH% parameter precedes the

    %MANTA_PATH% parameter exactly as shown above. The order of these two

    parameters is critical.

    The mantaConfig JVM Property

    The mantaConfig property is a required JVM parameter that specifies the location of the

    MantaRay configuration file. To set the mantaConfig property, perform any one of the

    following steps: Specify the path to the MantaRay configuration files in the Servlet context listener

    code.

    Specify the path to the MantaRay configuration files in the WebLogic specificstartup class code.

    Specify the path to the MantaRay configuration files in the WebLogic startup scriptfile (startWebLogic.cmd for Windows orstartWebLogic.shforUnix/Linux).

    %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS%-DmantaConfig=MANTA_HOME/config/default_confgi.xml-Dweblogic.Name=%SERVER_NAME%-Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE%

    -Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy"weblogic.Server

  • 8/9/2019 Deployment and Integration Guide 2-0

    21/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 13

    Registering MantaRay JMS objects in the JNDI Tree

    You must register the MantaRay JMS objects (ConnectionFactories, Queues, and

    Topics) in the server JNDI tree.

    There are two methods for registering the MantaRay JMS objects into the JNDI:

    Register objects at startup by using a Servlet context listener. This is the standard(and preferred) method, which works well with any J2EE compliant server without

    the need for any server-specific API.

    Register objects using a WebLogic startup class. The details of how to do this isbeyond the scope of this document, however a sample WebLogic startup class (page

    21) is provided for your convenience.

    Using a Servlet Context Lis tener

    1 Create a Servlet context listener class (See "Servlet Context Listener Class SampleCode" page 6).

    2 Create a web.xml (See "Web.xml Sample File" page 7) file that refers to the listener

    class.

    3 Pack the class and the web.xml file into a WAR file with the following basicstructure:

    WEB-INF/ - folder for application supportclasses/ - folder for compiled java filesweb.xml - configuration file for the application

    4 Move the WAR file to the %WL_HOME%%WL_DOMAIN%\applications folder.

    Notes:

    WL_HOME refers to the fully qualified path to the folder in which the WebLogic server

    files are installed.

    WL_DOMAIN refers to the relative path (from WL_HOME) to the folder in which the

    WebLogic domain is located.

  • 8/9/2019 Deployment and Integration Guide 2-0

    22/50

    11 May 2006 WebLogic 8.1 Configuration Process

    14 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Running the WebLogic Server

    1 Navigate to the WebLogic console using a URL in the form: http://:/console.For example, http://localhost:7001/console.

    2 Log in to the console. The WebLogic Console window appears in your browser.

    Verifying the JNDI Tree

    After you finish registering MantaRay JMS objects in the server JNDI tree, we

    recommend that you perform the following procedure to verify that they have been

    correctly registered. This process involves viewing the JNDI tree in the WebLogic

    console.

    1 Open and login to WebLogic Server Console using your web browser.

    2 From the WebLogic console window, right-click on the desired server, which islocated under the Servers branch of the desired domain (myDomain in the below

    example) in the JNDI Tree (left-hand) pane. Myserver is the WebLogic defaultserver name, as shown in the example below. You will likely have defined your ownserver names for your network.

    3 From the shortcut menu, select View JNDI tree. The JNDI Tree windowappears in a separate window.

    4 Browse the tree to verify the presence of the appropriate MantaRayconnectionFactories and destinations. To view details of an object on the tree, click

    on the desired object. The object details appear in the right-hand pane, as shown in

    the above example.

  • 8/9/2019 Deployment and Integration Guide 2-0

    23/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 15

    Configuring MantaRay as a Foreign JMS Provider

    Once you have completed registering the MantaRay JMS objects in the JNDI tree, you

    can use MantaRay as a JMS server using a regular JMS client in either environment.

    However, in order to consume JMS messages more efficiently, you should also register

    MantaRay as a foreign JMS provider in WebLogic.

    Registering MantaRay as a foreign JMS provider is a three stage process. You perform

    the configuration tasks in the JMS branch in WebLogic Navigation Tree, located in the

    left-hand pane of the browser window.

    1. Create a Foreign JMS Server.

    The Foreign JMS Server branch contains information about the local and/or

    remote JNDI provider, including its initial context factory, URL, and

    additional parameters. It is the parent of the Foreign JMS ConnectionFactory

    and Foreign JMS Destination nodes.

    2. Create Foreign JMS ConnectionFactories.

    Each node represents one foreign ConnectionFactory. The node contains the

    name of the ConnectionFactory in the remote JNDI provider, the name to

    map it to in the servers JNDI tree, and, optionally, a user name and

    password.

    3. Create Foreign JMS Destinations.

    Each node represents a foreign JMS Destination. It contains the name to

    look up on the foreign JNDI provider (MantaRay JMS destinations), and the

    name to map it to on the local server.

    Note: You can also define a foreign JMS provider by editing the config.xml (page20)

    file located in the %WL_HOME%%WL_DOMAIN% folder as an alternative to using the

    WebLogic Console.

    Creating the Foreign JMS Server

    To create a Foreign JMS Server, perform the following steps:

    1 Open and login to WebLogic Server Console using your web browser.

    2 In the Navigation Tree, click to select the | Services |JMS |Foreign JMS Servers node. The Foreign JMS Servers consolepage appears in the right-hand pane.

  • 8/9/2019 Deployment and Integration Guide 2-0

    24/50

    11 May 2006 WebLogic 8.1 Configuration Process

    16 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    3 Click the Configure a new Foreign JMS Server link. The definitionconsole page appears in the right-hand pane.

    4 Enter a name for the foreign JMS server in the Name field (for example,'mantaForeign ').

    5 Enter the class that must be instantiated to access the JNDI provider in the JNDIInitial Context Factory field. The default value'weblogic.jndi.WLInitialContextFactory ' appears automatically.

    6 Enter a URL in the JNDI Connection URL field (for example,t3://localhost:7001 ).

    7 Click the Create button to finish. The newly created foreign JMS server appears asa node in the Navigation Tree.

  • 8/9/2019 Deployment and Integration Guide 2-0

    25/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 17

    Creating Foreign Connection Factor ies

    To create new foreign JMS ConnectionFactories, perform the following steps:

    1 Click the Configure Foreign JMS Connection Factories link in theForeign JMS Connection console page. The Create a new ForeignJMS ConnectionFactory console page appears in the right-hand pane.

    2 Enter the name that the remote object is bound to in the local server JNDI directoryin the Local JNDI Name field.

    3 Enter the name of the remote object that will be looked up in the remote JNDI

    directory in the Remote JNDI Name field.

    4 Enter a user name and password in the appropriate fields as required.

    5 ClickCreate to complete the definition. The new ConnectionFactory appears as anode under the Foreign JMS ConnectionFactories node in theNavigation Tree.

  • 8/9/2019 Deployment and Integration Guide 2-0

    26/50

    11 May 2006 WebLogic 8.1 Configuration Process

    18 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Creating Foreign JMS Destinations

    To create new foreign JMS destinations, perform the following steps:

    1 Click the Configure Foreign JMS Destinations link in the ForeignJMS Connection console page. The Create a new Foreign JMSDestination console page appears.

    2 Enter the name that the remote object is bound to in the local server JNDI directory

    in the Local JNDI Name field.

    3 Enter the name of the remote object that will be looked up in the remote JNDI

    directory in the Remote JNDI Name field.

    4 ClickCreate to complete the definition. The new destination appears as a nodeunder the Foreign JMS Destination node in the Navigation Tree.

    Once deployed, foreign JMS MBeans create objects in the local server JNDI tree, which

    then performs a lookup of the referenced JMS objects whenever the foreign MBeans are

    looked up. This means that the local server and the remote JNDI folder are always

    synchronized.

  • 8/9/2019 Deployment and Integration Guide 2-0

    27/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 19

    Code Samples

    This section presents several examples of code that illustrate the concepts and

    configuration procedures. Explanatory notes are appended to some of the samples.

    Servlet Context Listener Class Sample Code

    package com.manta.sample.startup

    import org.mr.api.jms.*;import javax.jms.*;import javax.naming.InitialContext;import javax.naming.InitialContext;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContextListener;

    public class MantaStartup implements ServletContextListener {public MantaStartup() {super();}public void contextInitialized(ServletContextEvent sce) {

    try {//create connection factory objectsQueueConnectionFactory qFactory =

    new MantaQueueConnectionFactory();TopicConnectionFactory tFactory =

    new MantaTopicConnectionFactory();//initiate JNDI context//bind the connection factorie objects to the//JNDI treecontext.bind("mantaQCF", qFactory);System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");TopicConnection tcon =

    tFactory.createTopicConnection();QueueConnection qcon =

    qFactory.createQueueConnection();QueueSession qsess = qcon.createQueueSession(false,

    Session.AUTO_ACKNOWLEDGE);TopicSession tsess = tcon.createTopicSession(false,

    Session.AUTO_ACKNOWLEDGE);//bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);

    //bind topic to the JNDI treeString qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);

    context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();

    }catch (Exception e) { e.printStackTrace();}}public void contextDestroyed(ServletContextEvent sce) {}

    Web.xml Sample File

    com.manta.sample.startup.MantaStartup

  • 8/9/2019 Deployment and Integration Guide 2-0

    28/50

    11 May 2006 Code Samples

    20 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Config.xml Sample File

    Note: We recommend that you do not change the above config.xml file unless you knowwhat you are doing.

  • 8/9/2019 Deployment and Integration Guide 2-0

    29/50

    WebLogic 8.1 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 21

    Startup Class Sample Code

    package com.manta.sample.startup;import org.mr.api.jms.*;import javax.jms.*;import javax.naming.InitialContext;public class MantaBinder {

    public static void main(String[] args){try {//the follwing line is needed if the system property//is not set in the setDomainEnv files//System.setProperty("mantaConfig",// "C:/MantaHome/config/default_config.xml");//create connection factory objectsQueueConnectionFactory qFactory =

    new MantaQueueConnectionFactory();TopicConnectionFactory tFactory =

    new MantaTopicConnectionFactory();//initiate JNDI contextInitialContext context = new InitialContext();//bind the connection factorie objects to the//JNDI treecontext.bind("mantaQCF", qFactory);

    System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");TopicConnection tcon =

    tFactory.createTopicConnection();QueueConnection qcon =

    qFactory.createQueueConnection();QueueSession qsess = qcon.createQueueSession(false,

    Session.AUTO_ACKNOWLEDGE);TopicSession tsess = tcon.createTopicSession(false,

    Session.AUTO_ACKNOWLEDGE);//bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);//bind topic to the JNDI tree

    String qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();} catch (Exception e) { e.printStackTrace();}

    }}

  • 8/9/2019 Deployment and Integration Guide 2-0

    30/50

  • 8/9/2019 Deployment and Integration Guide 2-0

    31/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 23

    WebLogic 9.x

    In This ChapterWebLogic 9.x Configuration Process ..........................24

    Code Samples ..............................................................40

    This chapter presents the procedures for configuring WebLogic version 9.x so that

    MantaRay functions as a foreign JMS provider in this environment. The explanations

    and procedures contained in this chapter assume that you have successfully installed,

    configured and integrated WebLogic into your IT environment and that you are familiar

    with its operational concepts and procedures. For further information, please refer to the

    WebLogic documentation.

    The data displayed in the screen captures is for example purposes only. You should

    define object names and attributes for your environment according to your specificrequirements.

    This chapter further assumes that you have successfully installed and configured

    MantaRay on the server peer(s) and any client peers requiring MantaRay messaging

    capability. For details and instructions regarding installing and configuring MantaRay,

    please refer to the MantaRay Getting Started and Reference Guides.

    Note: Whenever you make changes to the WebLogic configuration using the WebLogic

    console, you must clickLock & Edit before you begin, andActivate Changes after all

    changes have been made.

    Notes: The following text expressions, appearing in this chapter, refer to specific file

    locations in instructions and code samples as specified below. When following the

    instructions or writing code, you should substitute the actual locations for these

    expressions.

    MANTA_HOME refers to the fully qualified path to the MantaRay installation folder.

    3

  • 8/9/2019 Deployment and Integration Guide 2-0

    32/50

    11 May 2006 WebLogic 9.x Configuration Process

    24 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    WebLogic 9.x Configuration Process

    The WebLogic configuration process consists of three sequential procedures:

    1 Specifying the location of the MantaRay JAR files and the MantaRay configurationfile.

    2 Registering MantaRay JMS objects in the JNDI tree.

    3 Registering MantaRay as a WebLogic foreign JMS provider.

    Each of these steps is described in detail in the following sections.

    Specifying the Location of MantaRay Files

    In order for WebLogic to work with MantaRay, you need to specify the location of the

    MantaRay JAR files and the MantaRay configuration file.

    1 Add the following line to the setDomainEnv.cmd (Windows) or the

    setDomainEnv.sh (Unix/Linux) file, located in theusersProjects/domain name/bin directory. Add any additional lines thatmay be required in your environment.

    set MANTA_PATH="%MANTA_HOME%\ext\antlr.jar;%MANTA_HOME%\manta.jar;%MANTA_HOME%\ext\clink-1.5.0.jar;%MANTA_HOME%\ext\commons-logging.jar;%MANTA_HOME%\ext\jms.jar;%MANTA_HOME%\ext\log4j-1.2.8.jar;%MANTA_HOME%\ext\jmxri.jar;%MANTA_HOME%\ext\jmxremote-jmx.jar;%MANTA_HOME%\ext\jmxtools.jar;"

    2 Add the MANTA_PATH to the class path.

    set PRE_CLASSPATH= %MANTA_PATH%

    The mantaConfig JVM Property

    The mantaConfig property is a required JVM parameter that specifies the location of the

    MantaRay configuration file. To set the mantaConfig property, perform any one of the

    following steps:

    Specify the path to the MantaRay configuration files in the Servlet context listenercode.

    Specify the path to the MantaRay configuration files in the WebLogic specificstartup class code.

    Specify the path to the MantaRay configuration files in the WebLogic script file(setDomainEnv.cmd for Windows orsetDomainEnv.shfor Unix/Linux).An example might read as follows:

    'JAVA_PROPERTIES=-DmantaConfig=C:\MantaRay_1.9_bin\config\default_config.xml'.

  • 8/9/2019 Deployment and Integration Guide 2-0

    33/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 25

    Running the WebLogic Server

    1 Navigate to the WebLogic console using a URL in the form: http://:/console.For example, http://localhost:7001/console.

    2 Log in to the console. The WebLogic Console window appears in your browser.

    Registering MantaRay JMS objects in the JNDI Tree

    You must register the MantaRay JMS objects (ConnectionFactories, Queues, and

    Topics) in the server JNDI tree.

    There are two methods for registering the MantaRay JMS objects into the JNDI:

    Register objects at startup by using a Servlet context listener. This is the standard(and preferred) method, which works well with any J2EE compliant server without

    the need for any server-specific API.

    Register objects using a WebLogic startup class.Using a Servlet Context Lis tener

    1 Create a Servlet context listener class (page 6).

    2 Create a web.xml file that refers to the listener class.

    3 Pack the class and the web.xml (page 7) file into a WAR file with the followingbasic structure:

    WEB-INF/ - folder for application supportclasses/ - folder for compiled java filesweb.xml - configuration file for the application

    4 Move the WAR file to the %WL_HOME%%WL_DOMAIN%\autodeploy folder.

    Notes:WL_HOME refers to the fully qualified path to the folder in which the WebLogic server

    files are installed.

    WL_DOMAIN refers to the relative path (from WL_HOME) to the folder in which the

    WebLogic domain is located.

    Using a WebLogic Startup Class

    The procedure for using a WebLogic startup class to register MantaRay JMS in the JNDI

    is comprised of several processes that are presented in the following sections.

    Creating the Startup Class

    The first step is to create and compile the WebLogic startup class. A sample startup class

    (page 21) is provided for your convenience.

  • 8/9/2019 Deployment and Integration Guide 2-0

    34/50

    11 May 2006 WebLogic 9.x Configuration Process

    26 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Registering the Startup Class

    1 Open and login to WebLogic Server Console using your web browser.

    2 ClickLock & Edit in the Change Center section, located in the upper left-hand side of the window.

    3 In the Domain Structure tree (located in the center left-hand pane in the abovescreen capture), open the Environment node and then click on the Startup &Shutdown Classes node. The Summary of Startup and ShutdownClasses console page appears in the right-hand pane.

    4 Click the New button in the lower left-hand corner of the page.

  • 8/9/2019 Deployment and Integration Guide 2-0

    35/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 27

    5 Select the Startup Class option button in the console page that appears, andthen clickNext to continue.

    6 The Configure a New Startup or Shutdown Class console pageappears. Enter a name for the startup class in the Name field.

    7 Enter the fully qualified class name in the Class Name field. This must agree withpath in your startup class code (For example, com.manta.sample.startup as

    in the sample startup class). ClickNext to continue.

  • 8/9/2019 Deployment and Integration Guide 2-0

    36/50

    11 May 2006 WebLogic 9.x Configuration Process

    28 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Note: Make certain that the startup class is added to the WebLogic class The Configure

    a New Startup or Shutdown Class console page appears. SelectStartupClass and then clickNext.

    8 Click the Activate Changes button in the upper-left hand corner of the browserwindow.

    9 Restart WebLogic Server.

  • 8/9/2019 Deployment and Integration Guide 2-0

    37/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 29

    Verifying JNDI Entries

    1 Open and login to WebLogic Administrative Console using your web browser.

    2 Select Environment | Servers from the Domain Structure tree. TheSummary of Servers console page appears.

    3 Click to the name of the desired server. Do not select the check box. TheSettings forAdminServer console page appears.

    4 Click the View JNDI Tree link, located in the upper left-hand corner of thispage. A new browser window opens, showing the domain structure.

    5 Navigate the Domain Structure tree to display details of the JNDI structure, asshown in the following sample screen capture. Verify that the JNDI information is

    correct.

  • 8/9/2019 Deployment and Integration Guide 2-0

    38/50

    11 May 2006 WebLogic 9.x Configuration Process

    30 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Configuring MantaRay as a Foreign JMS Provider

    Once you have completed registering the MantaRay JMS objects in the JNDI tree, you

    can use MantaRay as a JMS server using a regular JMS client in either environment.

    However, in order to consume JMS messages more efficiently, you should also register

    MantaRay as a foreign JMS provider in WebLogic.

    Creating a JMS Module

    1 Open and login to WebLogic Administrative Console using your web browser.

    2 ClickLock & Editin the Change Center section, located in the upper left-hand side of the window.

    3 Select Services | Messaging | JMS Modules from the DomainStructure tree. The JMS Modules console page appears in the right-handpane. ClickNew to continue.

  • 8/9/2019 Deployment and Integration Guide 2-0

    39/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 31

    4 Enter a name for the JMS provider in the Name field (for example: 'mantaray ').The remaining two fields are optional. ClickNext to continue.

    5 Select the check box for the desired target server in the Targets section. ClickNext to continue.

  • 8/9/2019 Deployment and Integration Guide 2-0

    40/50

    11 May 2006 WebLogic 9.x Configuration Process

    32 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    6 Select the Would you like to add resources? check box and then clickFinish.

    7 The The JMS module was created successfully. message appears.

  • 8/9/2019 Deployment and Integration Guide 2-0

    41/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 33

    Adding Resources to the JMS Module

    This procedure assumes that you are continuing immediately after completing the

    Creating a JMS Module steps described in the previous section.

    1 Click on the New button in the Summary of Resources section at the bottomof the Settings For.. console page. You do not need to select the check box.

  • 8/9/2019 Deployment and Integration Guide 2-0

    42/50

    11 May 2006 WebLogic 9.x Configuration Process

    34 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    2 Select Foreign Server from the option button group (WebLogic 9.1 as shownbelow) or from the Type drop-down list (WebLogic 9.0 - not shown). ClickNextto continue.

    3 Enter a name for the foreign server (e.g., mantaray) in the Name field, and then clickFinish.

    4 The Create a Mew JMS System Resource Module console page appears.ClickFinish to continue.

  • 8/9/2019 Deployment and Integration Guide 2-0

    43/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 35

    Configuring ConnectionFactories

    This procedure assumes that you are continuing immediately following completion of

    the Adding Resources to the JMS Module steps as described in the previoussection.

    1 Click on the name of the new resource (the foreign server that you have just created)

    that appears in the Summary of Resources table at the bottom of theSettings For... console page. You do not need to select the check box.

  • 8/9/2019 Deployment and Integration Guide 2-0

    44/50

    11 May 2006 WebLogic 9.x Configuration Process

    36 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    2 Enter the name of the class that must be instantiated to access the JNDI provider inthe JNDI Initial Context Factory field. The default value,'weblogic.jndi.WLInitialContextFactory ', appears automatically.

    3 Enter a value for the JNDI Connection URL field, enter the URL of the JNDI(e.g. t3://localhost:7001 ). The JNDI Properties field is optional.

  • 8/9/2019 Deployment and Integration Guide 2-0

    45/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 37

    4 Click the Connection Factories link. The Connection Factoriesconsole page appears. Create a new connection factory entry for each

    connectionFactory that is bound to the JNDI as follows:

    a Click the New button in the Foreign Connection Factories table.

    b Enter a name for the connectionFactory in the Name field.

    c Enter the name of the connectionFactory that is bound to the startup class in theLocal JNDI Name and Remote JNDI Name fields.

    d ClickOK to continue. The Connection Factories console page appears.

    e Repeat these steps for each connectionFactory. Please note that the sample dataappearing in the screen capture is for demonstration purposes only.

    5 The newly created connectionFactory entries appear in the ForeignConnection Factories table as shown below.

  • 8/9/2019 Deployment and Integration Guide 2-0

    46/50

    11 May 2006 WebLogic 9.x Configuration Process

    38 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Creating Foreign Destinations

    1 When you finish creating connectionFactories, click the Destinations link toadd those destinations that you bound to the startup class.

    2 Create a new destination entry for each destination that is bound to the JNDI asfollows:

    a Click the New button in the Foreign Destinations table.b Enter the JMS destination name in the Name field.

    c Enter the name of the JMS destination that is bound to the startup class in theLocal JNDI Name and Remote JNDI Name fields.

    d ClickOK to continue. The sample data appearing in the screen capture is fordemonstration purposes only.

  • 8/9/2019 Deployment and Integration Guide 2-0

    47/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 39

    3 The newly created destination entries appear in the Foreign Destinationstable as shown below.

    Activating the Definitions

    The final step in the definition process is to activate the definitions that you completed.

    To do so, click the Activate Changes button, located in the Change Centersection above the Domain Structure tree. This completes the definition process.

    Once deployed, foreign JMS MBeans create objects in the local server JNDI tree, which

    then performs a lookup of the referenced JMS objects whenever the foreign MBeans are

    looked up. This means that the local server and the remote JNDI folder are always

    synchronized.

  • 8/9/2019 Deployment and Integration Guide 2-0

    48/50

    11 May 2006 Code Samples

    40 Version 2.0 (DOC 2.0.0) MantaRay Deployment and Integration Guide

    Code Samples

    This section presents several examples of code that illustrate the concepts and

    configuration procedures. Explanatory notes are appended to some of the samples.

    Servlet Context Listener Class Sample Code

    package com.manta.sample.startup

    import org.mr.api.jms.*;import javax.jms.*;import javax.naming.InitialContext;import javax.naming.InitialContext;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContextListener;

    public class MantaStartup implements ServletContextListener {public MantaStartup() {super();}public void contextInitialized(ServletContextEvent sce) {

    try {//create connection factory objectsQueueConnectionFactory qFactory =

    new MantaQueueConnectionFactory();TopicConnectionFactory tFactory =

    new MantaTopicConnectionFactory();//initiate JNDI context//bind the connection factorie objects to the//JNDI treecontext.bind("mantaQCF", qFactory);System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");TopicConnection tcon =

    tFactory.createTopicConnection();QueueConnection qcon =

    qFactory.createQueueConnection();QueueSession qsess = qcon.createQueueSession(false,

    Session.AUTO_ACKNOWLEDGE);TopicSession tsess = tcon.createTopicSession(false,

    Session.AUTO_ACKNOWLEDGE);//bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);

    //bind topic to the JNDI treeString qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);

    context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();

    }catch (Exception e) { e.printStackTrace();}}public void contextDestroyed(ServletContextEvent sce) {}

    Code Sample Notes

    Modify JMS destinations as required by your applications. The MantaRayQueueConnectionFactory and

    MantaRayTopicConnectionFactory bindings are mandatory.

    We recommend that you use a configuration file to load destinations and connectionfactories in your code. This example uses hard-coded values for demonstration

    purposes only

  • 8/9/2019 Deployment and Integration Guide 2-0

    49/50

    WebLogic 9.x 11 May 2006

    MantaRay Deployment and Integration Guide Version 2.0 (DOC 2.0.0) 41

    Web.xml Sample File

    com.manta.sample.startup.MantaStartup

  • 8/9/2019 Deployment and Integration Guide 2-0

    50/50

    11 May 2006 Code Samples

    Startup Class Sample Code

    package com.manta.sample.startup;import org.mr.api.jms.*;import javax.jms.*;import javax.naming.InitialContext;public class MantaBinder {

    public static void main(String[] args){try {//the follwing line is needed if the system property//is not set in the setDomainEnv files//System.setProperty("mantaConfig",// "C:/MantaHome/config/default_config.xml");//create connection factory objectsQueueConnectionFactory qFactory =

    new MantaQueueConnectionFactory();TopicConnectionFactory tFactory =

    new MantaTopicConnectionFactory();//initiate JNDI contextInitialContext context = new InitialContext();//bind the connection factorie objects to the//JNDI treecontext.bind("mantaQCF", qFactory);

    System.out.println("bind mantaQCF");context.bind("mantaTCF", tFactory);System.out.println("bind mantaTCF");TopicConnection tcon =

    tFactory.createTopicConnection();QueueConnection qcon =

    qFactory.createQueueConnection();QueueSession qsess = qcon.createQueueSession(false,

    Session.AUTO_ACKNOWLEDGE);TopicSession tsess = tcon.createTopicSession(false,

    Session.AUTO_ACKNOWLEDGE);//bind topic to the JNDI treeString tName = new String("SampleTopic1");Topic tryT = tsess.createTopic(tName);context.bind(tName, tryT);//bind topic to the JNDI tree

    String qName = new String("SampleQueue1");Queue tryQ = qsess.createQueue(qName);context.bind(qName, tryQ);System.out.println("finished binding");context.close();tcon.close();qcon.close();} catch (Exception e) { e.printStackTrace();}

    }}

    Code Sample Notes

    Modify JMS destinations as required by your applications. The MantaRayQueueConnectionFactory and

    MantaRayTopicConnectionFactory bindings are mandatory.

    We recommend that you use a configuration file to load destinations and connectionfactories in your code. This example uses hard-coded values for demonstration

    purposes only