Wrapping IBM MQ client library JARs into an OSGI bundle - 6.3

Talend ESB Service Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
Installation and Upgrade
EnrichPlatform
Talend ESB

This section describes how to wrap IBM WMQ client library jars into an OSGi bundle that can be used to create client connections to WMQ in an OSGi environment.

Prerequisites:

The following WMQ JARs (version 7.5) should be installed into the local maven repository:

  • CL3Export.jar

  • CL3Nonexport.jar

  • com.ibm.mq.commonservices.jar

  • com.ibm.mq.headers.jar

  • com.ibm.mq.jmqi.jar

  • com.ibm.mq.jms.Nojndi.jar

  • com.ibm.mq.pcf.jar

  • com.ibm.mqjms.jar

  • dhbcore.jar rmm.jar

To install JAR files into local repository, run the following commands from the directory that contains the JARs:

mvn install:install-file -Dfile=dhbcore.jar -DgroupId=com.ibm -DartifactId=com.ibm.disthub2.dhbcore -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mq.jms.Nojndi.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq.jms.Nojndi -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mq.jmqi.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq.jmqi -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mqjms.jar -DgroupId=com.ibm -DartifactId=com.ibm.mqjms -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=CL3Export.jar -DgroupId=com.ibm -DartifactId=cl3export -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=CL3Nonexport.jar -DgroupId=com.ibm -DartifactId=cl3nonexport -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mq.commonservices.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq.commonservices -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=rmm.jar -DgroupId=com.ibm -DartifactId=rmm -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mq.headers.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq.headers -Dversion=7.5 -Dpackaging=jar
mvn install:install-file -Dfile=com.ibm.mq.pcf.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq.pcf -Dversion=7.5 -Dpackaging=jar
  1. Add the file pom.xml containing the following content into an empty directory:

    <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
     http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
     <modelVersion>4.0.0</modelVersion>
    
     <groupId>osgi.com.ibm</groupId>
     <artifactId>wsmq</artifactId>
     <version>7.5</version>
     <packaging>bundle</packaging>
     <name>Websphere MQ client libraries OSGi Bundle</name>
     <description>This OSGi bundle simply wraps several WMQ artifacts into one.</description>
    
     <properties>
       <wmq.version>${project.version}</wmq.version>
     </properties>
    
     <dependencies>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq.jms.Nojndi</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq.jmqi</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mqjms</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.disthub2.dhbcore</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>cl3export</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>cl3nonexport</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq.commonservices</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>rmm</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq.headers</artifactId>
         <version>${wmq.version}</version>
       </dependency>
       <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq.pcf</artifactId>
         <version>${wmq.version}</version>
       </dependency>
     </dependencies>
    
     <build>
       <defaultGoal>install</defaultGoal>
    
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-shade-plugin</artifactId>
           <version>1.1</version>
           <executions>
             <execution>
               <phase>package</phase>
               <goals>
                 <goal>shade</goal>
               </goals>
               <configuration>
                 <artifactSet>
                   <includes>
                     <include>com.ibm:*</include>
                   </includes>
                 </artifactSet>
                 <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
                 <createDependencyReducedPom>true</createDependencyReducedPom>
               </configuration>
             </execution>
           </executions>
         </plugin>
         <plugin>
           <groupId>org.apache.felix</groupId>
           <artifactId>maven-bundle-plugin</artifactId>
           <version>2.1.0</version>
           <extensions>true</extensions>
             <configuration>
               <instructions>
                 <Bundle-SymbolicName>wmq-osgi-bundle</Bundle-SymbolicName>
                 <Export-Package>*</Export-Package>
                 <Import-Package>
    com.ibm.disthub2.impl.multi.*;resolution:=optional,
    com.ibm.disthub2.impl.multicast.server;resolution:=optional,
    com.ibm.disthub2.impl.server;resolution:=optional,
    com.ibm.disthub2.impl.server.*;resolution:=optional,
    com.ibm.disthub2.impl.util.*;resolution:=optional, com.ibm.ejs.*;resolution:=optional,
    com.ibm.rmm.ptl.tchan.*;resolution:=optional,
    com.ibm.disthub2.broker.reference.security;resolution:=optional,
    com.ibm.misc;resolution:=optional, com.ibm.mq.internal;resolution:=optional,
    com.ibm.crypto.pkcs11impl.provider;resolution:=optional,
    com.ibm.crypto.provider;resolution:=optional, com.ibm.security.*;resolution:=optional,
    sun.net.www;resolution:=optional, sun.security.*;resolution:=optional, *
                 </Import-Package>
                 <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                 <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Embed-Dependency</_removeheaders>
               </instructions>
               <unpackBundle>true</unpackBundle>
             </configuration>
         </plugin>
       </plugins>
     </build>
    </project>
  2. Go to the directory that contains the pom.xml and create a subdirectory src/main/resources/META-INF.

  3. Place the file compinfo.properties containing the following content to the directory src/main/resources/META-INF:

    CompList: comp1,comp2,comp3,comp4
    
    comp1_CompClass:com.ibm.msg.client.wmq.factories.WMQComponent
    comp2_CompClass:com.ibm.msg.client.commonservices.j2se.J2SEComponent
    comp3_CompClass: com.ibm.msg.client.jms.internal.JMSComponent
    comp4_CompClass: com.ibm.mq.jms.MQJMSComponent
  4. Go to the directory that contains the pom.xml file and use the following command:

    mvn clean install

    During Maven build on Linux, a RuntimeException may occur with the message: " data starting at XX is in unknown format". This Exception is harmless and does not affect the build result.

  5. The bundle file wsmq-7.5.jar will appear in the subdirectory target/. This bundle can be used for deployment into OSGi.

  6. To deploy the bundle, copy the wsmq-7.5.jar file to the directory <TESB-HOME>/container/deploy.