このサンプルでは、WebSphere MQ が JMS プロバイダーとして使用されるので、JMSAdmin ツールを使用することによって、管理対象オブジェクトを作成しなければなりません。
サンプルを Linux 上で実行する場合、JMSAdmin クラスをクラスパスに追加する必要があります。 以下のファイルをクラスパスに追加します。
<mq_install_directory>/java/lib/com.ibm.mqjms.jar
Java の場所を PATH 変数に追加するには、クラスパスに以下のファイルを組み込みます。
<JAVA_HOME>/bin
WebSphere MQ は mq_install_dir ディレクトリーにインストールされています。 JMSAdmin ツールおよび JMSAdmin 構成ファイルは、Linux では mq_install_dir/java/bin、Windows では mq_install_dir¥java¥bin にあります。
Address Book サンプル・フロー・プロジェクトでは、AddressBookSample.defs ファイルを JMSAdmin ツールと共に使用する必要があります。
JMSAdmin ツールを使用する前に、以下の指示に従って JMSAdmin.config ファイルを変更する必要があります。
JMSAdmin.config ファイルを変更するには、次のようにします。
# The following line specifies which JNDI service provider is in use. # It currently indicates a File System Context. If a different # service provider is used, this line must be commented out and the # appropriate one must be uncommented. # # com.sun.jndi.fscontext.RefFSContextFactory is the FileSystem JNDI Context # #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory # # The following line specifies the URL of the initial # context for the service provider. It currently refers to a File System Context. # Examples of an LDAP root context URL and the JNDI namespace # for WebSphere are also shown, commented out. # #PROVIDER_URL=ldap://localhost/o=ibm,c=us PROVIDER_URL=file:/C:/SOAPJNDIBindings #PROVIDER_URL=iiop://localhost/
これで、オブジェクトを作成できます。
WebSphere MQ JMSAdmin ツールを実行して JNDI 管理対象オブジェクトを作成し、サンプルで使用する JMS 接続ファクトリーと宛先を構成します。
JMSAdmin ツールは入力として AddressBookSample.defs ファイルを使用します。 JMSAdmin を使用し、入力として AddressBookSample.defs ファイルを使用することによって、それらのオブジェクトを作成します。
コマンド行に、以下のコマンドを入力します。
cd mq_install_dir¥java¥bin JMSAdmin < "workspace_path¥AddressBook¥AddressBookSample.defs"
cd mq_install_dir/java/bin ./setjmsenv ./JMSAdmin < workspace_path/AddressBook/AddressBookSample.defs
mq_install_dir は、WebSphere MQ がインストールされている場所であり、workspace_path は、WebSphere Message Broker Toolkit ワークスペース・ディレクトリーの絶対パスです。
それらのオブジェクトと .bindings ファイルが作成されます。
SOAP ノードでは、.bindings ファイルの場所が既に構成されています。ただし、別の場所で .bindings ファイルを作成した場合は、SOAP ノードで .bindings ファイルの場所を別の場所に再構成する必要があります。以下の『SOAP ノードで .bindings ファイルの場所を構成する操作』セクションの手順を実行してください。
作成した .bindings ファイルの場所がメッセージ・フローの SOAP ノードで認識されているかどうかを確認するために、以下の『SOAP ノードで .bindings ファイルの場所を構成する操作』セクションの手順を実行してください。
変更後の AddressBookConsumerFlow フローと AddressBookProviderFlow フローをデプロイするために、両方のメッセージ・フローを組み込んだブローカー・アーカイブ (BAR) ファイルを再ビルドします。
BAR ファイルをビルドするには、次のようにします。
これで、サンプルを実行する準備ができたことになります。