spring - Cannot convert value of type [com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle] to required type [javax.jms.ConnectionFactory] -


i have standard spring jms config

    <bean id="jmstemplate" class="org.springframework.jms.core.jmstemplate">         <property name="connectionfactory" ref="connectionfactory" />         <property name="defaultdestination" ref="jmsdestination" />     </bean>     <bean id="connectionfactory" class="org.springframework.jndi.jndiobjectfactorybean">         <property name="jndiname" value="jms/mqauditqueueconnectionfactory" />     </bean>     <bean id="jmsdestinationresolver" class="org.springframework.jndi.jndiobjectfactorybean">         <property name="jndiname" value="jms/mqauditqueue" />     </bean> 

and think standard mq on 8.5.5.2, when start web-app get:

 cannot convert value of type [com.ibm.ejs.jms.jmsqueueconnectionfactoryhandle] required type [javax.jms.connectionfactory] property 'connectionfactory' 

i note server have following classes in following jars

class  com/ibm/ejs/jms/jmsqueueconnectionfactoryhandle.class found in /opt/websphere/was8//plugins/com.ibm.ws.runtime.jar 

and

com/ibm/mq/jms/mqqueueconnectionfactory.class found in /opt/websphere/was8//installedconnectors/wmq.jmsra.rar/com.ibm.mqjms.jar 

how mq use 2nd jar?

i went through lot of trial , error find answer. mentioned above excluding jms library works. how exclude jms library , still able compile code? no 1 seems have mentioned. solution make scope jms library "provided" (if using maven or gradle).

as mentioned somewhere:

"provided means need jar compiling, @ run time there jar provided environment don't need packaged app. web app, means jar file not placed web-inf/lib directory."

so in pom.xml add/update these:

<dependency>     <groupid>org.springframework</groupid>     <artifactid>spring-jms</artifactid>     <version>4.3.4.release</version>     <exclusions>         <exclusion>             <groupid>javax.jms</groupid>             <artifactid>javax.jms-api</artifactid>         </exclusion>     </exclusions> </dependency>  <dependency>     <groupid>javax.jms</groupid>     <artifactid>jms</artifactid>     <version>1.1</version>     <scope>provided</scope> </dependency> 

hopefully can helpful have been frustrated lack of answers internet.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -