以下のリンクを参照して、Spring MDP/Activation Spec を使用して IBM MQ に接続します。
スタンドアロンの Maven アプリケーションで実行すると、以下のエラーが発生します。この問題を解決するのを手伝ってください。
MQJCA1006: JCA クラスの誤ったバージョンが見つかりました。展開に失敗しました。JCA クラスがクラスパスで見つかりましたが、正しいバージョンではありませんでした。このエラーは、アプリケーション サーバーがクラス パスで connector.jar を検出した場合に発生する可能性があります。この JAR ファイルは、J2SE 環境の WebSphere MQ classes for JMS に必要ですが、J2EE 1.4 環境では必要ありません。
pom.xml:
<properties>
<ibmmq.version>7.0.1.0</ibmmq.version>
<spring.version>3.2.12.RELEASE</spring.version>
</properties>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- other spring dependencies -->
<!-- other spring dependencies -->
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.mqjms</artifactId>
<version>${ibmmq.version}</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>connector</artifactId>
<version>${ibmmq.version}</version>
</dependency>
<!-- other MQ dependencies -->
<dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<version>1.5</version>
</dependency>
例外:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myResourceAdapterBean' defined in class path resource [spring/common-jms-context.xml]: Invocation of init method failed; nested exception is com.ibm.mq.connector.DetailedResourceAdapterInternalException: MQJCA1006: An incorrect version of the JCA classes was found. Deployment failed. The JCA classes were found in the class path but were not the correct version. This error can occur if the application server finds connector.jar in the class path. This JAR file is required by WebSphere MQ classes for JMS in a J2SE environment, but is not required in a J2EE 1.4 environment.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)