You are on page 1of 50

MantaRay

Deployment and
Integration Guide
Next Generation Distributed Messaging
Version 2.0 (DOC 2.0.0.)

Coridan Inc.

Copyright Notice 11 May 2006

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:support@coridan.com)
Website: (http://www.coridan.com)

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

11 May 2006

Table of Contents
Copyright Notice iii

Table of Contents iv

Preface v
About this Manual ........................................................................................................................................v
Audience............................................................................................................................................v
MantaRay Documentation.................................................................................................................v
Document Conventions ....................................................................................................................vi
About Coridan ........................................................................................................................................... vii
Worldwide Technical Support ................................................................................................................... vii
Feature Requests............................................................................................................................ viii
Bug Reports................................................................................................................................... viii
JBoss Versions 3.x and 4.x 1
JBoss Configuration Process ........................................................................................................................1
Specifying the Location of MantaRay Files ......................................................................................2
Registering MantaRay JMS objects in the JNDI Tree.......................................................................3
Configuring MantaRay as a Foreign JMS Provider...........................................................................4
Code Samples ...............................................................................................................................................6
Servlet Context Listener Class Sample Code ....................................................................................6
Web.xml Sample File ........................................................................................................................7
JBoss Startup Destination MBean Interface ......................................................................................7
JBoss Startup Destination MBean Implementation ...........................................................................8
WebLogic 8.1 11
WebLogic 8.1 Configuration Process .........................................................................................................11
Specifying the Location of MantaRay Files ....................................................................................11
Registering MantaRay JMS objects in the JNDI Tree.....................................................................13
Running the WebLogic Server ........................................................................................................14
Verifying the JNDI Tree..................................................................................................................14
Configuring MantaRay as a Foreign JMS Provider.........................................................................15
Code Samples .............................................................................................................................................19
Servlet Context Listener Class Sample Code ..................................................................................19
Web.xml Sample File ......................................................................................................................19
Config.xml Sample File...................................................................................................................20
Startup Class Sample Code..............................................................................................................21
WebLogic 9.x 23
WebLogic 9.x Configuration Process .........................................................................................................24
Specifying the Location of MantaRay Files ....................................................................................24
Running the WebLogic Server ........................................................................................................25
Registering MantaRay JMS objects in the JNDI Tree.....................................................................25
Configuring MantaRay as a Foreign JMS Provider.........................................................................30
Code Samples .............................................................................................................................................40
Servlet Context Listener Class Sample Code ..................................................................................40
Web.xml Sample File ......................................................................................................................41
Startup Class Sample Code..............................................................................................................42

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

Preface 11 May 2006

Preface
In This Chapter
About this Manual .......................................................v
About Coridan .............................................................vii
Worldwide 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 explanatory
text, 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-peer
messaging 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 detailed
instructions 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.

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

0. Typeface Description Terms Emphasizes specific terms and concepts. work-arounds and other good ideas to help you work more efficiently Caution . 11 May 2006 About this Manual Document Conventions The following table shows the typographic conventions used for this book. Icon Description Tips .Informative information Java code sample XML code segment or file vi Version 2.0 (DOC 2.Pay careful attention to the instructions in order to avoid errors or unexpected results Warning . tips.Tips. tricks. cautions and warnings C ommand 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.Failure to follow the instructions will result in an error or system instability Notes .0) MantaRay Deployment and Integration Guide . generally when first introduced Code Sample Code samples and configuration file text Note Notes.

Israel.com) are available for download from our web site ƒ A help forum (http://sourceforge. such as log files and descriptions of the testing scenario MantaRay Deployment and Integration Guide Version 2. we provide first class support for all of our products and technologies via our web site (http://www. MantaRay benefits from the support of thousands of developers worldwide who provide constant feedback.Description of messaging scenario and requirements . Massachusetts. etc.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. Worldwide Technical Support At Coridan. This information and more is available at the MantaRay Project website (http://sourceforge. fixes. webinars. when possible: ƒ Your name and contact information ƒ Your company or organization ƒ Product version number and build ƒ Platform and operating system information: .Operating system and version .net/projects/mantaray/). When contacting technical support. Coridan is backed by leading institutional venture capital firms that take a hands-on approach in nurturing promising high-tech companies. upcoming events.Hardware description .0. 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. bug reports. Located in Boston. please supply the following information.coridan. bug fixes.Preface 11 May 2006 About Coridan Coridan is a leading provider of peer-to-peer messaging middleware products that provide cutting-edge alternatives to traditional messaging solutions. work-arounds and feature requests.com). As an open source project. inquiries. The Coridan team includes high tech veterans with many years of experience in developing world-class software products. USA and Herzliya.0 (DOC 2. seminars.coridan.Firewalls and other network security software ƒ Problem description and any documentation that may help in resolving the problem.0) vii . Coridan was founded in 2003.Available memory .

please supply the information requested above for technical support. please submit it at MantaRay: Feature Requests: Submit Tracker Item (https://sourceforge.0. viii Version 2.0) MantaRay Deployment and Integration Guide . 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.0 (DOC 2.net.net/tracker/?func=add&group_id=112623&atid=663826). 11 May 2006 Worldwide Technical Support Feature Requests If you have a feature request. When submitting a bug report.

. you should substitute the actual locations for these expressions. appearing in this chapter.so that MantaRay functions as a foreign JMS provider in this environment. MantaRay Deployment and Integration Guide Version 2..... configured and integrated JBoss Application Server into your IT environment and that you are familiar with its operational concepts and procedures..... When following the instructions or writing code. Notes: The following text expressions.0 (DOC 2...... 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... MANTA_HOME refers to the fully qualified path to the MantaRay installation folder...x and 4..... please refer to the MantaRay Getting Started and Reference Guides....... For further information............. JBOSS_HOME refers to the fully qualified path to the folder in which the JBoss Server files are located..... For details and instructions regarding installing and configuring MantaRay.........6 This chapter presents the procedures for configuring JBoss Application Server versions 3. refer to specific file locations in instructions and code samples as specified below.......... The explanations and procedures contained in this chapter assume that you have successfully installed..x and 4.... This chapter further assumes that you have successfully installed and configured MantaRay on the Application Server peer(s) and any client peers requiring MantaRay messaging capability..x.x and 4.0) 1 .0..JBoss Versions 3.......................x 11 May 2006 1 JBoss Versions 3.. please refer to the JBoss documentation.......1 Code Samples ...x In This Chapter JBoss Configuration Process ..

jar.sh for Unix/Linux). located under the JBOSS_HOME\bin folder.0.0. JAR files (add other relevant JAR files as required) set MANTA_PATH="%MANTA_HOME%\\antlr.xml 2 Version 2.jar. ƒ Specify the path to the MantaRay configuration files in the JBoss startup script (run.jar.0) MantaRay Deployment and Integration Guide . %MANTA_HOME%\ext\commons-logging. To set the mantaConfig property. %MANTA_HOME%\ext\jmxremote. ƒ Specify the path to the MantaRay configuration files in the JBoss specific startup class code." MANTA_PATH set JBOSS_CLASSPATH = %JBOSS_CLASSPATH%.jar and all jar files from the Manta/ext folder into the JBOSS_HOME\server\default\lib folder. MantaRay JAR Files To specify the location of the MantaRay JAR files. %MANTA_HOME%\manta.2.8.jar.bat for Windows or run. %MANTA_HOME%\ext\log4j-1. %MANTA_HOME%\ext\clink-1.jar. perform either of the following steps: ƒ Copy the Manta.jar. ƒ Manually add the MantaRay class path to the JBoss startup script (run.sh for Unix/Linux).jar. Add the following line: Set JAVA_OPTS=%JAVA_OPTS% - DmantaConfig=%MANTA_CONFIG\config\default_config.jar. %MANTA_HOME%\ext\jms. you need to specify the location of the MantaRay JAR files and the MantaRay configuration file.0 (DOC 2. perform any one of the following steps: ƒ Specify the path to the MantaRay configuration files in the Servlet context listener code. 11 May 2006 JBoss Configuration Process Specifying the Location of MantaRay Files In order for JBoss to work with MantaRay. bat for Windows or run . %MANTA_HOME%\ext\jmxtools.5.jar. located under the JBOSS_HOME\bin folder.%MANTA_PATH% The mantaConfig JVM property The mantaConfig property is a required JVM parameter that specifies the location of the MantaRay configuration file. %MANTA_HOME%\ext\jmxri.

x 11 May 2006 Registering MantaRay JMS objects in the JNDI Tree You must register the MantaRay JMS objects (ConnectionFactories. To Deploy a Startup Class Using a Servlet Context Listener 1 Create a Servlet context listener class (See "Servlet Context Listener Class Sample Code" page 6). which works well with any J2EE compliant server without the need for any server-specific API.xml Sample File" page 7) file that refers to the listener class. To Register MantaRay Objects Using a JBoss Startup Class 1 Create a startup MBean that holds the MantaRay destinations and binds them into the JNDI tree.xml file into a WAR file with the following basic structure: WEB-INF/ . and Topics) in the server JNDI tree.folder for application support lib/ . The following procedures describe both methods.xml file in the META-INF folder.folder for supporting jar files classes/ .xml .xml MantaStartupMBean.folder for compiled java files web. ƒ Register objects using a JBoss startup class. manta- startup.manta:service=MantaStartup"/> </server> c Pack the compiled class and interface with the jboss-service. 2 Create a web. 2 Generate a JBoss SAR file: a Compile the MantaRay startup class and interface.JBoss Versions 3. manta-startup.0" encoding="UTF-8"?> <server> <mbean code="MantaStartup" name="JBoss. This is the standard (and preferred) method. b Create a jboss-service. There are two methods for registering the MantaRay JMS objects into the JNDI tree: ƒ Register objects at startup by using a Servlet context listener. 3 Move the SAR file to the JBOSS_HOME\server\default\deploy folder. The MBean is comprised of two files.class d Change the file extension from . Queues.x and 4.sar).jar) with the following basic structure: META-INF jboss-service. the MBean interface (See "JBoss Startup Destination MBean Interface" page 7) and the MBean implementation (See "JBoss Startup Destination MBean Implementation" page 8).0 (DOC 2. containing the following lines: <?xml version="1. 3 Pack the class and the web.class MantaStartup.sar (for example.jar to.0.configuration file for the application 4 Move the WAR file to the JBOSS_HOME\server\default\deploy folder.0) 3 .xml (See "Web.xml file into a JAR file (for example. MantaRay Deployment and Integration Guide Version 2.

To register the MantaRay JMS server as a Foreign JMS provider: 1 Set the RecursiveSearch attribute to 'T r u e ' in the.JMSContainerInvoker </proxy-factory> <proxy-factory-config> <JMSProviderAdapterJNDI>MantaMQ</JMSProviderAdapterJNDI> <ServerSessionPoolFactoryJNDI>StdJMSPool </ServerSessionPoolFactoryJNDI> <MinimumSize>1</MinimumSize> <KeepAliveMillis>30000</KeepAliveMillis> <MaximumSize>15</MaximumSize> <MaxMessages>1</MaxMessages> <MDBConfig> <ReconnectIntervalSec>10</ReconnectIntervalSec> <DLQConfig> <DestinationQueue>queue/DLQ</DestinationQueue> <MaxTimesRedelivered>10</MaxTimesRedelivered> <TimeToLive>0</TimeToLive> </DLQConfig> </MDBConfig> </proxy-factory-config> </invoker-proxy-binding> 3 Insert the following code into the < container-configurations> tag: 4 Version 2.ejb. you should also register MantaRay as a foreign JMS provider in JBoss.name=MantaJMSProvider </invoker-mbean> <proxy-factory>org.xml file: <invoker-proxy-binding> <name>Manta-message-driven-bean</name> <invoker-mbean> JBoss.plugins.mq:service=JMSProviderLoader. in order to consume JMS messages more efficiently. <attribute name="RecursiveSearch">True</attribute> 2 Insert the following code into the < invoker-proxy-bindings> tag in the jboss-service. you can use MantaRay as a JMS server using a regular JMS client in either environment.0. However.0) MantaRay Deployment and Integration Guide .jboss. located in the JBOSS_HOME\server\default\conf folder. 11 May 2006 JBoss Configuration Process Configuring MantaRay as a Foreign JMS Provider Once you have completed registering the MantaRay JMS objects in the JNDI tree.jms.0 (DOC 2.

ejb.jboss.jboss.jboss.CachedConnectionInterceptor </interceptor> </container-interceptors> <instance-pool> org.ejb.MessageDrivenTxInterceptorBMT </interceptor> <interceptor transaction="Bean" metricsEnabled="true"> org.ejb.plugins.jboss.LogInterceptor</interceptor> <interceptor>org.plugins.0.ejb.ejb.ejb.jboss.jndi.jboss.JBoss Versions 3.plugins.jboss.xml file.plugins.MetricsInterceptor</interceptor> <interceptor transaction="Container"> org.plugins.ejb.plugins.CMT --> <interceptor transaction="Container"> org.ProxyFactoryFinderInterceptor </interceptor> <interceptor>org.jboss.mq:service=JMSProviderLoader.MessageDrivenInstanceInterceptor </interceptor> <!-.plugins.RunAsSecurityInterceptor </interceptor> <!-.0) 5 .plugins.x and 4.plugins.The JMS provider loader --> <mbean code="org.x 11 May 2006 <container-configuration> <container-name>Manta MDB support</container-name> <call-logging>true</call-logging> <invoker-proxy-binding-name>Manta-message-driven-bean </invoker-proxy-binding-name> <container-interceptors> <interceptor>org.MessageDrivenInstancePool </instance-pool> <instance-cache></instance-cache> <persistence-manager></persistence-manager> <container-pool-conf> <MaximumSize>100</MaximumSize> </container-pool-conf> </container-configuration> 4 Add the following MBean descriptor to the jms-ds.jboss.jboss.plugins.ejb.MessageDrivenInstanceInterceptor </interceptor> <interceptor transaction="Bean"> org.jndi.jboss. located in the JBOSS_HOME\server\default\deploy\jms folder.ejb.MetricsInterceptor</interceptor> <interceptor> org.JMSProviderLoader" name="JBoss.jms.resource.jms.jboss.BMT --> <interceptor transaction="Bean"> org. <!-. This code should be nested in the <connection-factories> tag.0 (DOC 2.connectionmanager.ejb.TxInterceptorCMT</interceptor> <interceptor transaction="Container" metricsEnabled="true"> org.JNDIProviderAdapter </attribute> <attribute name="QueueFactoryRef">mantaQCF</attribute> <attribute name="TopicFactoryRef">mantaTCF</attribute> </mbean> MantaRay Deployment and Integration Guide Version 2.jboss.name=MantaJMSProvider"> <attribute name="ProviderName">MantaMQ</attribute> <attribute name="ProviderAdapterClass"> org.

*. import javax.close().println("bind mantaTCF").ServletContextEvent.InitialContext. import javax. Session. import javax.close(). //bind topic to the JNDI tree String tName = new String("SampleTopic1"). System.printStackTrace().out.InitialContext.println("finished binding").api.servlet. TopicSession tsess = tcon.startup import org.out.createQueue(qName). public class MantaStartup implements ServletContextListener { public MantaStartup() {super(). ƒ The MantaRayQueueConnectionFactory and MantaRayTopicConnectionFactory bindings are mandatory.jms.AUTO_ACKNOWLEDGE).*. }catch (Exception e) { e. //initiate JNDI context //bind the connection factorie objects to the //JNDI tree context. import javax.ServletContextListener.} } public void contextDestroyed(ServletContextEvent sce) {} Code Sample Notes ƒ Modify JMS destinations as required by your applications. Session.createTopicSession(false. Queue tryQ = qsess.jms.AUTO_ACKNOWLEDGE). Explanatory notes are appended to some of the samples. tryT). qcon.println("bind mantaQCF"). ƒ We recommend that you use a configuration file to load destinations and connection factories in your code. This example uses hard-coded values for demonstration purposes only 6 Version 2. context.out. qFactory). QueueSession qsess = qcon.createTopicConnection().0. context. //bind topic to the JNDI tree String qName = new String("SampleQueue1").bind(qName. TopicConnection tcon = tFactory.naming.sample. Topic tryT = tsess. Servlet Context Listener Class Sample Code package com.bind("mantaTCF".bind("mantaQCF". tcon.0) MantaRay Deployment and Integration Guide .servlet. context.0 (DOC 2. import javax. context. tryQ).createTopic(tName).mr. System.createQueueConnection().manta.naming. System. 11 May 2006 Code Samples Code Samples This section presents several examples of code that illustrate the concepts and configuration procedures. TopicConnectionFactory tFactory = new MantaTopicConnectionFactory(). QueueConnection qcon = qFactory.} public void contextInitialized(ServletContextEvent sce) { try { //create connection factory objects QueueConnectionFactory qFactory = new MantaQueueConnectionFactory().close().createQueueSession(false. tFactory).bind(tName.

Inc.3//EN" "http://java. public abstract void start() throws Exception.0 (DOC 2.MantaStartup </listener-class> </listener> </web-app> JBoss Startup Destination MBean Interface public interface MantaStartupMBean { public abstract void init() throws Exception.JBoss Versions 3.startup.0) 7 .manta.sample.x and 4. public abstract void stop() throws Exception.//DTD Web Application 2.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems.dtd"> <web-app> <listener> <listener-class> com.0.com/dtd/web-app_2_3. public abstract void destroy() throws Exception.x 11 May 2006 Web.sun.xml Sample File <?xml version="1. } MantaRay Deployment and Integration Guide Version 2.

} catch (Exception e) { e. import javax.println("bind mantaCF").0 (DOC 2.naming.lang. mfactory). //initiate JNDI context InitialContext context = new InitialContext(). Session. qcon.Boolean registrationDone){ } public void preDeregister() throws java.bind(qName.out.out. TopicSession tsess = tcon. context. ObjectName name) throws java.management. TopicConnection tcon = tFactory.createTopic(tName). Session.bind("mantaCF".api. qfactory).*.println("finished binding"). System.lang.close().*.mr. TopicConnectionFactory tFactory = new MantaTopicConnectionFactory().Exception { return new ObjectName(":service=MantaStartup").bind("mantaTCF". QueueConnection qcon = qfactory.out.close().createTopicSession(false. import javax. context.createQueueSession(false.} } public void stop() throws Exception { //write custom code here to do implement any cleanup functionality } public void destroy() throws Exception {} } 8 Version 2.util. //bind the connection factorie objects to the //JNDI tree context. tcon. Topic tryT = tsess. //bind topic to the JNDI tree String tName = new String("SampleTopic1").println("bind mantaQCF"). 11 May 2006 Code Samples JBoss Startup Destination MBean Implementation import org. context.printStackTrace().lang. ConnectionFactory mfactory = new MantaConnectionFactory(). MantaStartupMBean { public MantaStartup() {} public ObjectName preRegister(MBeanServer server.AUTO_ACKNOWLEDGE). tFactory). Queue tryQ = qsess.createTopicConnection().0. import org.*.close().*. import javax.AUTO_ACKNOWLEDGE).out.Exception {} public void postDeregister() {} public void init() throws Exception {} public void start() throws Exception { try { //create connection factory objects QueueConnectionFactory qfactory = new MantaQueueConnectionFactory().jms.createQueueConnection().*. tryQ). System.println("bind mantaTCF"). context. QueueSession qsess = qcon.jms. tryT). context.jboss.createQueue(qName). System.bind(tName.0) MantaRay Deployment and Integration Guide . System.bind("mantaQCF". //bind topic to the JNDI tree String qName = new String("SampleQueue1"). public class MantaStartup implements MBeanRegistration. } public void postRegister(java.

0. ƒ We recommend that you use a configuration file to load destinations and connection factories. ƒ The MantaRayQueueConnectionFactory and MantaRayTopicConnectionFactory bindings are mandatory.JBoss Versions 3.x and 4.0 (DOC 2.x 11 May 2006 Code Sample Notes ƒ Modify destinations as required by your applications. This example uses hard-coded values for demonstration purposes only. MantaRay Deployment and Integration Guide Version 2.0) 9 .

.

.. configured and integrated WebLogic into your IT environment and that you are familiar with its operational concepts and procedures... you need to specify the location of the MantaRay JAR files and the MantaRay configuration file.....1 11 May 2006 2 WebLogic 8.......0) 11 ..1 so that MantaRay functions as a foreign JMS provider in this environment...cmd (Windows) or startWebLogic...WebLogic 8........0.....sh (Unix/Linux) file..11 Code Samples ..... MANTA_HOME refers to the fully qualified path to the MantaRay installation folder.....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......... To configure WebLogic to locate the MantaRay JAR files: 1 Manually add the MantaRay class path to the startWebLogic. For details and instructions regarding installing and configuring MantaRay......19 This chapter presents the procedures for configuring WebLogic version 8.. You should define object names and attributes for your environment according to your specific requirements. refers to a specific file location in instructions and code samples as specified below. Specifying the Location of MantaRay Files In order for WebLogic to work properly with MantaRay...1 Configuration Process........ For further information...1 In This Chapter WebLogic 8. The explanations and procedures contained in this chapter assume that you have successfully installed. The data displayed in the screen captures is for example purposes only.0 (DOC 2.... please refer to the WebLogic documentation.... appearing in this chapter.. When following the instructions or writing code........ you should substitute the actual location for this expression... Notes: The following text expression... MantaRay Deployment and Integration Guide Version 2.. WebLogic 8. Add any additional lines that may be required in your environment. please refer to the MantaRay Getting Started and Reference Guides. 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....

jar.cmd for Windows or startWebLogic.jar.2.security. The order of these two parameters is critical. %MANTA_HOME%\ext\jmxri.jar.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.jar. %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -DmantaConfig=”MANTA_HOME/config/default_confgi." 2 Add the MANTA_PATH to the class path.xml” -Dweblogic.jar.jar.Server 12 Version 2.0) MantaRay Deployment and Integration Guide .Name=%SERVER_NAME% -Dweblogic.sh for Unix/Linux).jar. %MANTA_HOME%\ext\jms.1 Configuration Process set MANTA_PATH="%MANTA_HOME%\ext\antlr.policy="%WL_HOME%\server\lib\weblogic.0.jar. set CLASSPATH= %CLASSPATH%. %MANTA_HOME%\manta.8. %MANTA_HOME%\ext\commons-logging.0. %MANTA_PATH% Warning: Make certain that the %CLASSPATH% parameter precedes the %MANTA_PATH% parameter exactly as shown above. 11 May 2006 WebLogic 8. To set the mantaConfig property. %MANTA_HOME%\ext\log4j-1.0 (DOC 2.jar. %MANTA_HOME%\ext\jmxremote-jmx. The mantaConfig JVM Property The mantaConfig property is a required JVM parameter that specifies the location of the MantaRay configuration file. perform any one of the following steps: ƒ Specify the path to the MantaRay configuration files in the Servlet context listener code. %MANTA_HOME%\ext\jmxtools. ƒ Specify the path to the MantaRay configuration files in the WebLogic specific startup class code.policy" weblogic.5. %MANTA_HOME%\ext\clink-1. ƒ Specify the path to the MantaRay configuration files in the WebLogic startup script file (startWebLogic.

Queues. WL_DOMAIN refers to the relative path (from WL_HOME) to the folder in which the WebLogic domain is located. 2 Create a web. The details of how to do this is beyond the scope of this document.1 11 May 2006 Registering MantaRay JMS objects in the JNDI Tree You must register the MantaRay JMS objects (ConnectionFactories.xml Sample File" page 7) file that refers to the listener class.folder for compiled java files web.0) 13 .xml . There are two methods for registering the MantaRay JMS objects into the JNDI: ƒ Register objects at startup by using a Servlet context listener.WebLogic 8. 3 Pack the class and the web. which works well with any J2EE compliant server without the need for any server-specific API. Notes: WL_HOME refers to the fully qualified path to the folder in which the WebLogic server files are installed.xml file into a WAR file with the following basic structure: WEB-INF/ .folder for application support classes/ .configuration file for the application 4 Move the WAR file to the %WL_HOME%%WL_DOMAIN%\applications folder. MantaRay Deployment and Integration Guide Version 2. ƒ Register objects using a WebLogic startup class.xml (See "Web. Using a Servlet Context Listener 1 Create a Servlet context listener class (See "Servlet Context Listener Class Sample Code" page 6).0. and Topics) in the server JNDI tree.0 (DOC 2. This is the standard (and preferred) method. however a sample WebLogic startup class (page 21) is provided for your convenience.

Verifying the JNDI Tree After you finish registering MantaRay JMS objects in the server JNDI tree. select View JNDI tree.0) MantaRay Deployment and Integration Guide . we recommend that you perform the following procedure to verify that they have been correctly registered. http://localhost:7001/console. 1 Open and login to WebLogic Server Console using your web browser.1 Configuration Process Running the WebLogic Server 1 Navigate to the WebLogic console using a URL in the form: http://<ip address or hostname>:<port>/console. You will likely have defined your own server names for your network. which is located under the Servers branch of the desired domain (m yD omain in the below example) in the JNDI Tree (left-hand) pane. The WebLogic Console window appears in your browser. 11 May 2006 WebLogic 8. as shown in the example below. The JNDI Tree window appears in a separate window. The object details appear in the right-hand pane. as shown in the above example. 14 Version 2. This process involves viewing the JNDI tree in the WebLogic console.0 (DOC 2. 4 Browse the tree to verify the presence of the appropriate MantaRay connectionFactories and destinations. For example. click on the desired object. Myserver is the WebLogic default server name. 3 From the shortcut menu. 2 Log in to the console. To view details of an object on the tree.0. right-click on the desired server. 2 From the WebLogic console window.

0) 15 . You perform the configuration tasks in the JMS branch in WebLogic Navigation Tree. you should also register MantaRay as a foreign JMS provider in WebLogic.WebLogic 8. Note: You can also define a foreign JMS provider by editing the config. and additional parameters. It is the parent of the Foreign JMS ConnectionFactory and Foreign JMS Destination nodes. URL. click to select the <DomainName> | Services | JMS | Foreign JMS Servers node. The Foreign JMS Server branch contains information about the local and/or remote JNDI provider. and.1 11 May 2006 Configuring MantaRay as a Foreign JMS Provider Once you have completed registering the MantaRay JMS objects in the JNDI tree. and the name to map it to on the local server. 1. Create Foreign JMS Destinations. Each node represents one foreign ConnectionFactory. The Foreign JMS Servers console page appears in the right-hand pane. Create Foreign JMS ConnectionFactories. The node contains the name of the ConnectionFactory in the remote JNDI provider. including its initial context factory. MantaRay Deployment and Integration Guide Version 2. 2 In the Navigation Tree. perform the following steps: 1 Open and login to WebLogic Server Console using your web browser. Each node represents a foreign JMS Destination. a user name and password.0.0 (DOC 2. optionally. Registering MantaRay as a foreign JMS provider is a three stage process. located in the left-hand pane of the browser window. you can use MantaRay as a JMS server using a regular JMS client in either environment. 3. the name to map it to in the server’s JNDI tree.xml (page 20) file located in the %WL_HOME%%WL_DOMAIN% folder as an alternative to using the WebLogic Console. 2. Creating the Foreign JMS Server To create a Foreign JMS Server. It contains the name to look up on the foreign JNDI provider (MantaRay JMS destinations). in order to consume JMS messages more efficiently. However. Create a Foreign JMS Server.

The newly created foreign JMS server appears as a node in the Navigation Tree. t 3: //l ocalh ost: 7001 ). The default value 'w ebl ogi c. 4 Enter a name for the foreign JMS server in the Name field (for example.1 Configuration Process 3 Click the Configure a new Foreign JMS Server link. 6 Enter a URL in the JNDI Connection URL field (for example.0) MantaRay Deployment and Integration Guide .0 (DOC 2. 11 May 2006 WebLogic 8. 'm a nt aF o rei gn '). WL In it ialC ont ext F act ory ' appears automatically.0. 5 Enter the class that must be instantiated to access the JNDI provider in the JNDI Initial Context Factory field. 7 Click the Create button to finish.jn di. 16 Version 2. The definition console page appears in the right-hand pane.

5 Click Create to complete the definition. 2 Enter the name that the remote object is bound to in the local server JNDI directory in the Local JNDI Name field. The Create a new Foreign JMS ConnectionFactory console page appears in the right-hand pane. MantaRay Deployment and Integration Guide Version 2.0.1 11 May 2006 Creating Foreign Connection Factories To create new foreign JMS ConnectionFactories.0 (DOC 2.0) 17 . 3 Enter the name of the remote object that will be looked up in the remote JNDI directory in the Remote JNDI Name field. perform the following steps: 1 Click the Configure Foreign JMS Connection Factories link in the Foreign JMS Connection console page. 4 Enter a user name and password in the appropriate fields as required. The new ConnectionFactory appears as a node under the Foreign JMS ConnectionFactories node in the Navigation Tree.WebLogic 8.

The Create a new Foreign JMS Destination console page appears.0 (DOC 2. perform the following steps: 1 Click the Configure Foreign JMS Destinations link in the Foreign JMS Connection console page.0) MantaRay Deployment and Integration Guide .0. which then performs a lookup of the referenced JMS objects whenever the foreign MBeans are looked up. Once deployed. 4 Click Create to complete the definition. 11 May 2006 WebLogic 8. The new destination appears as a node under the Foreign JMS Destination node in the Navigation Tree. 3 Enter the name of the remote object that will be looked up in the remote JNDI directory in the Remote JNDI Name field. This means that the local server and the remote JNDI folder are always synchronized. 2 Enter the name that the remote object is bound to in the local server JNDI directory in the Local JNDI Name field. 18 Version 2. foreign JMS MBeans create objects in the local server JNDI tree.1 Configuration Process Creating Foreign JMS Destinations To create new foreign JMS destinations.

com/dtd/web-app_2_3.AUTO_ACKNOWLEDGE).} } public void contextDestroyed(ServletContextEvent sce) {} Web.api.manta.AUTO_ACKNOWLEDGE). import javax.servlet.InitialContext. import javax. tcon. qFactory).printStackTrace(). import javax.createQueueSession(false.startup import org.jms.createTopicConnection().*.0) 19 .xml Sample File <?xml version="1.bind("mantaTCF". Session. //bind topic to the JNDI tree String qName = new String("SampleQueue1").println("finished binding").dtd"> <web-app> <listener> <listener-class> com.//DTD Web Application 2. context. tFactory). TopicConnection tcon = tFactory.MantaStartup </listener-class> </listener> </web-app> MantaRay Deployment and Integration Guide Version 2.0.3//EN" "http://java. qcon.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems.startup.naming. tryT).1 11 May 2006 Code Samples This section presents several examples of code that illustrate the concepts and configuration procedures. //bind topic to the JNDI tree String tName = new String("SampleTopic1").mr. import javax.bind("mantaQCF". System. context. QueueConnection qcon = qFactory.createTopicSession(false. TopicSession tsess = tcon.bind(tName.out.bind(qName. Servlet Context Listener Class Sample Code package com.createQueueConnection(). //initiate JNDI context //bind the connection factorie objects to the //JNDI tree context. System.ServletContextListener.InitialContext.ServletContextEvent.sample. import javax.println("bind mantaQCF"). QueueSession qsess = qcon. context.createTopic(tName).WebLogic 8. Topic tryT = tsess. TopicConnectionFactory tFactory = new MantaTopicConnectionFactory(). Inc.sample. System. }catch (Exception e) { e. context.manta. Explanatory notes are appended to some of the samples.} public void contextInitialized(ServletContextEvent sce) { try { //create connection factory objects QueueConnectionFactory qFactory = new MantaQueueConnectionFactory().println("bind mantaTCF").createQueue(qName).jms.out. Queue tryQ = qsess. Session.sun. public class MantaStartup implements ServletContextListener { public MantaStartup() {super(). tryQ).close().servlet.*.naming.out.close().0 (DOC 2.close().

xml file unless you know what you are doing.xml Sample File <ForeignJMSServer ConnectionURL="t3://localhost:7001" JNDIProperties="" Name="mantaForeign" Targets="myserver"> <ForeignJMSConnectionFactory LocalJNDIName="local/mantaQCF" Name="qConFactory" RemoteJNDIName="mantaQCF"/> <ForeignJMSConnectionFactory LocalJNDIName="local/mantaTCF" Name="tConFactory" RemoteJNDIName="mantaTCF"/> <ForeignJMSDestination LocalJNDIName="local/SampleTopic1" Name="mantaTopic1" RemoteJNDIName="SampleTopic1"/> <ForeignJMSDestination LocalJNDIName="local/SampleQueue1" Name="mantaQueue1" RemoteJNDIName="SampleQueue1"/> </ForeignJMSServer> Note: We recommend that you do not change the above config. 11 May 2006 Code Samples Config.0 (DOC 2.0) MantaRay Deployment and Integration Guide .0. 20 Version 2.

println("finished binding").createQueueConnection(). Session. System.jms. context.out. import javax.mr.xml").createTopic(tName).println("bind mantaQCF"). System. System. //create connection factory objects QueueConnectionFactory qFactory = new MantaQueueConnectionFactory().api.sample.setProperty("mantaConfig".bind(qName. } catch (Exception e) { e. qFactory). QueueSession qsess = qcon. qcon.out.close().bind("mantaTCF".WebLogic 8.jms. context. TopicConnection tcon = tFactory.0 (DOC 2. TopicSession tsess = tcon.bind("mantaQCF".InitialContext. //bind topic to the JNDI tree String qName = new String("SampleQueue1").AUTO_ACKNOWLEDGE).*.startup. context.0.createTopicConnection().out. import org.naming. tcon. QueueConnection qcon = qFactory.0) 21 . //bind topic to the JNDI tree String tName = new String("SampleTopic1").manta.createTopicSession(false.createQueueSession(false.close().println("bind mantaTCF"). // "C:/MantaHome/config/default_config. //initiate JNDI context InitialContext context = new InitialContext(). import javax. //bind the connection factorie objects to the //JNDI tree context. tryQ). Queue tryQ = qsess.} } } MantaRay Deployment and Integration Guide Version 2. tryT).close().bind(tName. tFactory).*. TopicConnectionFactory tFactory = new MantaTopicConnectionFactory(). Session.AUTO_ACKNOWLEDGE).printStackTrace().1 11 May 2006 Startup Class Sample Code package com. Topic tryT = tsess.createQueue(qName). 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. context.

.

.. please refer to the WebLogic documentation.... configured and integrated WebLogic into your IT environment and that you are familiar with its operational concepts and procedures.. The data displayed in the screen captures is for example purposes only............x so that MantaRay functions as a foreign JMS provider in this environment.x 11 May 2006 3 WebLogic 9. For details and instructions regarding installing and configuring MantaRay.........WebLogic 9.0) 23 ... When following the instructions or writing code..40 This chapter presents the procedures for configuring WebLogic version 9.. 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. The explanations and procedures contained in this chapter assume that you have successfully installed. Notes: The following text expressions.. You should define object names and attributes for your environment according to your specific requirements............. MANTA_HOME refers to the fully qualified path to the MantaRay installation folder.x In This Chapter WebLogic 9... refer to specific file locations in instructions and code samples as specified below.. please refer to the MantaRay Getting Started and Reference Guides... Note: Whenever you make changes to the WebLogic configuration using the WebLogic console......... For further information........... and Activate Changes after all changes have been made... you should substitute the actual locations for these expressions....x Configuration Process............ appearing in this chapter..0 (DOC 2.. you must click Lock & Edit before you begin....24 Code Samples .0. MantaRay Deployment and Integration Guide Version 2.

0 (DOC 2.jar. 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.5. you need to specify the location of the MantaRay JAR files and the MantaRay configuration file. %MANTA_HOME%\ext\clink-1. %MANTA_HOME%\ext\jms.x Configuration Process The WebLogic configuration process consists of three sequential procedures: 1 Specifying the location of the MantaRay JAR files and the MantaRay configuration file.0) MantaRay Deployment and Integration Guide .jar. %MANTA_HOME%\ext\log4j-1.2. set MANTA_PATH="%MANTA_HOME%\ext\antlr. located in the usersProjects/domain name/bin directory.sh for Unix/Linux).jar. Specifying the Location of MantaRay Files In order for WebLogic to work with MantaRay. Each of these steps is described in detail in the following sections. perform any one of the following steps: ƒ Specify the path to the MantaRay configuration files in the Servlet context listener code." 2 Add the MANTA_PATH to the class path.jar. 1 Add the following line to the setDomainEnv. %MANTA_HOME%\ext\commons-logging.9_bin\config\default_config.jar.jar. Add any additional lines that may be required in your environment.sh (Unix/Linux) file.jar. 24 Version 2. %MANTA_HOME%\manta. 11 May 2006 WebLogic 9.cmd for Windows or setDomainEnv.cmd (Windows) or the setDomainEnv.0. %MANTA_HOME%\ext\jmxtools.8.jar. 3 Registering MantaRay as a WebLogic foreign JMS provider. An example might read as follows: 'JAVA_PROPERTIES=-DmantaConfig= C:\MantaRay_1.x Configuration Process WebLogic 9.0. To set the mantaConfig property.jar. %MANTA_HOME%\ext\jmxremote-jmx. ƒ Specify the path to the MantaRay configuration files in the WebLogic specific startup class code. ƒ Specify the path to the MantaRay configuration files in the WebLogic script file (setDomainEnv.xml'. %MANTA_HOME%\ext\jmxri. 2 Registering MantaRay JMS objects in the JNDI tree.

WL_DOMAIN refers to the relative path (from WL_HOME) to the folder in which the WebLogic domain is located. MantaRay Deployment and Integration Guide Version 2. and Topics) in the server JNDI tree. which works well with any J2EE compliant server without the need for any server-specific API.xml file that refers to the listener class. ƒ Register objects using a WebLogic startup class.x 11 May 2006 Running the WebLogic Server 1 Navigate to the WebLogic console using a URL in the form: http://<ip address or hostname>:<port>/console. This is the standard (and preferred) method. The WebLogic Console window appears in your browser. For example. http://localhost:7001/console. Registering MantaRay JMS objects in the JNDI Tree You must register the MantaRay JMS objects (ConnectionFactories. 3 Pack the class and the web.folder for compiled java files web. Creating the Startup Class The first step is to create and compile the WebLogic startup class.0) 25 . Queues. 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.configuration file for the application 4 Move the WAR file to the %WL_HOME%%WL_DOMAIN%\autodeploy folder.xml (page 7) file into a WAR file with the following basic structure: WEB-INF/ .0. A sample startup class (page 21) is provided for your convenience.folder for application support classes/ .WebLogic 9. Notes: WL_HOME refers to the fully qualified path to the folder in which the WebLogic server files are installed. 2 Log in to the console. 2 Create a web. Using a Servlet Context Listener 1 Create a Servlet context listener class (page 6).0 (DOC 2. There are two methods for registering the MantaRay JMS objects into the JNDI: ƒ Register objects at startup by using a Servlet context listener.xml .

26 Version 2. open the Environment node and then click on the Startup & Shutdown Classes node.0 (DOC 2.x Configuration Process Registering the Startup Class 1 Open and login to WebLogic Server Console using your web browser.0) MantaRay Deployment and Integration Guide . located in the upper left- hand side of the window. 4 Click the New button in the lower left-hand corner of the page.0. 3 In the Domain Structure tree (located in the center left-hand pane in the above screen capture). The Summary of Startup and Shutdown Classes console page appears in the right-hand pane. 2 Click Lock & Edit in the Change Center section. 11 May 2006 WebLogic 9.

6 The Configure a New Startup or Shutdown Class console page appears. This must agree with path in your startup class code (For example. Click Next to continue. Enter a name for the startup class in the Name field.m ant a.s t artu p as in the sample startup class). and then click Next to continue. MantaRay Deployment and Integration Guide Version 2. samp l e.0) 27 .x 11 May 2006 5 Select the Startup Class option button in the console page that appears. 7 Enter the fully qualified class name in the Class Name field.0. c om .WebLogic 9.0 (DOC 2.

9 Restart WebLogic Server.x Configuration Process Note: Make certain that the startup class is added to the WebLogic class The Configure a New Startup or Shutdown Class console page appears. 28 Version 2.0) MantaRay Deployment and Integration Guide . 11 May 2006 WebLogic 9.0. 8 Click the Activate Changes button in the upper-left hand corner of the browser window.0 (DOC 2. Select Startup Class and then click Next.

located in the upper left-hand corner of this page.0. A new browser window opens. Do not select the check box. 2 Select Environment | Servers from the Domain Structure tree. showing the domain structure. MantaRay Deployment and Integration Guide Version 2. The Settings for AdminServer console page appears.0) 29 .WebLogic 9. 5 Navigate the Domain Structure tree to display details of the JNDI structure. as shown in the following sample screen capture.x 11 May 2006 Verifying JNDI Entries 1 Open and login to WebLogic Administrative Console using your web browser. 4 Click the View JNDI Tree link. The Summary of Servers console page appears. Verify that the JNDI information is correct.0 (DOC 2. 3 Click to the name of the desired server.

0 (DOC 2. However. you can use MantaRay as a JMS server using a regular JMS client in either environment. Creating a JMS Module 1 Open and login to WebLogic Administrative Console using your web browser. 30 Version 2.x Configuration Process Configuring MantaRay as a Foreign JMS Provider Once you have completed registering the MantaRay JMS objects in the JNDI tree. Click New to continue. The JMS Modules console page appears in the right-hand pane. 11 May 2006 WebLogic 9. 3 Select Services | Messaging | JMS Modules from the Domain Structure tree.0. located in the upper left- hand side of the window. 2 Click Lock & Edit in the Change Center section. in order to consume JMS messages more efficiently. you should also register MantaRay as a foreign JMS provider in WebLogic.0) MantaRay Deployment and Integration Guide .

The remaining two fields are optional.WebLogic 9.0) 31 .0. Click Next to continue. 5 Select the check box for the desired target server in the Targets section. Click Next to continue.0 (DOC 2. MantaRay Deployment and Integration Guide Version 2.x 11 May 2006 4 Enter a name for the JMS provider in the Name field (for example: 'm an t a ra y ').

0 (DOC 2. 32 Version 2.x Configuration Process 6 Select the Would you like to add resources? check box and then click Finish. 11 May 2006 WebLogic 9.0) MantaRay Deployment and Integration Guide . 7 The “The JMS module was created successfully.0.” message appears.

MantaRay Deployment and Integration Guide Version 2.x 11 May 2006 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. You do not need to select the check box.0. 1 Click on the New button in the Summary of Resources section at the bottom of the Settings For.0) 33 .. console page.WebLogic 9.0 (DOC 2.

34 Version 2.g. 3 Enter a name for the foreign server (e.x Configuration Process 2 Select Foreign Server from the option button group (WebLogic 9. 4 The Create a Mew JMS System Resource Module console page appears.0. and then click Finish. Click Finish to continue. mantaray) in the Name field. Click Next to continue.0) MantaRay Deployment and Integration Guide . 11 May 2006 WebLogic 9.0 (DOC 2.1 as shown below) or from the Type drop-down list (WebLogic 9..not shown).0 .

WebLogic 9.. You do not need to select the check box.0) 35 .0 (DOC 2.x 11 May 2006 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 previous section. console page. 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 the Settings For.0.. MantaRay Deployment and Integration Guide Version 2.

3 Enter a value for the JNDI Connection URL field. 36 Version 2.jn di. enter the URL of the JNDI (e. appears automatically.0. The JNDI Properties field is optional.g. t 3:/ /local host :7001 ).0) MantaRay Deployment and Integration Guide . WL In it ialC ont ext F act ory '.0 (DOC 2. The default value. 'w ebl ogi c. 11 May 2006 WebLogic 9.x Configuration Process 2 Enter the name of the class that must be instantiated to access the JNDI provider in the JNDI Initial Context Factory field.

x 11 May 2006 4 Click the Connection Factories link.WebLogic 9. c Enter the name of the connectionFactory that is bound to the startup class in the Local JNDI Name and Remote JNDI Name fields.0) 37 .0 (DOC 2. The Connection Factories console page appears. Please note that the sample data appearing in the screen capture is for demonstration purposes only. e Repeat these steps for each connectionFactory. The Connection Factories console 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. d Click OK to continue. MantaRay Deployment and Integration Guide Version 2. 5 The newly created connectionFactory entries appear in the Foreign Connection Factories table as shown below. b Enter a name for the connectionFactory in the Name field.0.

0. c Enter the name of the JMS destination that is bound to the startup class in the Local JNDI Name and Remote JNDI Name fields. b Enter the JMS destination name in the Name field.0 (DOC 2. click the Destinations link to add those destinations that you bound to the startup class.x Configuration Process Creating Foreign Destinations 1 When you finish creating connectionFactories. d Click OK to continue. The sample data appearing in the screen capture is for demonstration purposes only. 11 May 2006 WebLogic 9. 38 Version 2. 2 Create a new destination entry for each destination that is bound to the JNDI as follows: a Click the New button in the Foreign Destinations table.0) MantaRay Deployment and Integration Guide .

This means that the local server and the remote JNDI folder are always synchronized. click the Activate Changes button. To do so.0 (DOC 2. foreign JMS MBeans create objects in the local server JNDI tree.0.x 11 May 2006 3 The newly created destination entries appear in the Foreign Destinations table as shown below. This completes the definition process.WebLogic 9.0) 39 . Once deployed. MantaRay Deployment and Integration Guide Version 2. located in the Change Center section above the Domain Structure tree. Activating the Definitions The final step in the definition process is to activate the definitions that you completed. which then performs a lookup of the referenced JMS objects whenever the foreign MBeans are looked up.

System. //initiate JNDI context //bind the connection factorie objects to the //JNDI tree context. import javax. context. 11 May 2006 Code Samples Code Samples This section presents several examples of code that illustrate the concepts and configuration procedures.InitialContext.createTopic(tName).out.naming. qFactory). TopicConnection tcon = tFactory.jms.} public void contextInitialized(ServletContextEvent sce) { try { //create connection factory objects QueueConnectionFactory qFactory = new MantaQueueConnectionFactory(). TopicSession tsess = tcon.bind("mantaQCF". Servlet Context Listener Class Sample Code package com.naming. import javax.jms. //bind topic to the JNDI tree String tName = new String("SampleTopic1"). QueueSession qsess = qcon.createQueue(qName).*.manta. Topic tryT = tsess. tFactory).close().0 (DOC 2.AUTO_ACKNOWLEDGE).InitialContext. tryQ). qcon. Explanatory notes are appended to some of the samples.println("finished binding").close().createTopicSession(false.0) MantaRay Deployment and Integration Guide .out. ƒ We recommend that you use a configuration file to load destinations and connection factories in your code. import javax. Session.startup import org.println("bind mantaQCF").AUTO_ACKNOWLEDGE). TopicConnectionFactory tFactory = new MantaTopicConnectionFactory().printStackTrace().bind("mantaTCF".sample. context. context.ServletContextListener. QueueConnection qcon = qFactory. System. //bind topic to the JNDI tree String qName = new String("SampleQueue1"). ƒ The MantaRayQueueConnectionFactory and MantaRayTopicConnectionFactory bindings are mandatory. context.} } public void contextDestroyed(ServletContextEvent sce) {} Code Sample Notes ƒ Modify JMS destinations as required by your applications.api.servlet. import javax.createQueueSession(false.servlet. }catch (Exception e) { e. Queue tryQ = qsess.close().out. tcon.createQueueConnection(). tryT).0. This example uses hard-coded values for demonstration purposes only 40 Version 2.createTopicConnection(). import javax. System.bind(tName.println("bind mantaTCF").bind(qName. public class MantaStartup implements ServletContextListener { public MantaStartup() {super(). Session.ServletContextEvent.*.mr.

0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems.0. Inc.manta.MantaStartup </listener-class> </listener> </web-app> MantaRay Deployment and Integration Guide Version 2.//DTD Web Application 2.0 (DOC 2.startup.sun.x 11 May 2006 Web.0) 41 .3//EN" "http://java.WebLogic 9.dtd"> <web-app> <listener> <listener-class> com.com/dtd/web-app_2_3.sample.xml Sample File <?xml version="1.

mr.close().naming.bind(tName.out.sample.*. TopicConnectionFactory tFactory = new MantaTopicConnectionFactory().printStackTrace(). tryQ). //create connection factory objects QueueConnectionFactory qFactory = new MantaQueueConnectionFactory().InitialContext.createQueueConnection(). System.xml"). tFactory).0 (DOC 2. QueueSession qsess = qcon.bind("mantaQCF". 11 May 2006 Code Samples Startup Class Sample Code package com.AUTO_ACKNOWLEDGE). Session. //bind topic to the JNDI tree String tName = new String("SampleTopic1").createQueueSession(false. TopicSession tsess = tcon. // "C:/MantaHome/config/default_config.bind(qName.out. qcon.createTopic(tName).println("bind mantaTCF"). ƒ The MantaRayQueueConnectionFactory and MantaRayTopicConnectionFactory bindings are mandatory. TopicConnection tcon = tFactory.createTopicSession(false.api. context. context. //bind the connection factorie objects to the //JNDI tree context.AUTO_ACKNOWLEDGE).println("bind mantaQCF").startup.close().createQueue(qName). } catch (Exception e) { e. //initiate JNDI context InitialContext context = new InitialContext().manta. Queue tryQ = qsess.*.} } } Code Sample Notes ƒ Modify JMS destinations as required by your applications. 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. qFactory). import org. import javax.0) MantaRay Deployment and Integration Guide .bind("mantaTCF".jms. tcon.setProperty("mantaConfig".createTopicConnection(). This example uses hard-coded values for demonstration purposes only 42 Version 2. //bind topic to the JNDI tree String qName = new String("SampleQueue1"). Session. Topic tryT = tsess.out. context. context.close(). System. tryT).println("finished binding"). ƒ We recommend that you use a configuration file to load destinations and connection factories in your code. System.0. import javax. QueueConnection qcon = qFactory.jms.