Hi,
I am new to JMS and spring. I am in my initial phase of configuring JMS (queue- point to Point) with JBoss 4.2.3 and Spring. I am facing the following exception while launching the server.
Error creating bean with name 'jmsTransactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.jboss.mq.SpyConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.jboss.mq.SpyConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
As advised in another thread, I checked if JMS jar or activemq-all.jar exist in the class path. But, they are not.
Please find below the code excerpts for reference.
1. Queue defined in "jbossmq-destinations-service.xml"
2. Resource reference of ConnectionFactory and Queue in web.xmlCode:<mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=myjms"> <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> </mbean>
3. Resource reference of ConnectionFactory and Queue in jboss-web.xmlCode:<resource-ref id="ResourceRef_CF"> <res-ref-name>jms/QCF</res-ref-name> <res-type>javax.jms.QueueConnectionFactory</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> <resource-ref id="ResourceRef_Queue"> <description /> <res-ref-name>myjms</res-ref-name> <res-type>javax.jms.Queue</res-type> <res-auth>Container</res-auth> </resource-ref>
4. Bean defined for ConnectionFactory, TransactionManager and DestinationCode:<resource-ref id="ResourceRef_CF"> <description></description> <res-ref-name>jms/QCF</res-ref-name> <res-type>javax.jms.QueueConnectionFactory</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> <jndi-name>java:/ConnectionFactory</jndi-name> </resource-ref> <resource-ref id="ResourceRef_Queue"> <description></description> <res-ref-name>myjms</res-ref-name> <res-type>javax.jms.Queue</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> <jndi-name>queue/myjms</jndi-name> </resource-ref>
Code:<!-- JMS beans --> <bean name="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:/ConnectionFactory"/> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <!-- jms destination already defined in jboss --> <bean name="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/queue/myjms" /> </bean>
Please let me know if I have misconfigured or left out anything. Thanks.


Reply With Quote