-
1. Re: Simple Spring 3 example
anastopoulos Aug 10, 2011 10:12 AM (in response to yairogen)Hi, I'm running on JBoss and experiencing the same problem.
Below is an excerpt of my spring config:
<bean name="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="connectionfactoryJndi" />
</bean>
<bean name="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="destinationJndi" />
</bean>
<bean name="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="defaultDestination" ref="destination" />
<property name="receiveTimeout" value="1" />
<property name="sessionTransacted" value="true" />
</bean>
And the error:
15:39:47,523 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in ServletContext resource [/WEB-INF/classes/bus-context-resources.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hornetq.jms.client.HornetQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hornetq.jms.client.HornetQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or co
nversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) [:3.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [:3.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [:3.0.5.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) [:3.0.5.RELEASE]
...
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hornetq.jms.client.HornetQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hornetq.jms.client.HornetQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462) [:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499) [:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) [:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [:3.0.5.RELEASE]
... 86 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.hornetq.jms.client.HornetQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) [:3.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447) [:3.0.5.RELEASE]
... 92 more
What's happening? How to fix it?
Thanks.
-
2. Re: Simple Spring 3 example
beve Aug 10, 2011 10:19 AM (in response to yairogen)Hi,
could you try using 'org.hornetq.jms.client.HornetQJMSConnectionFactory' and see if that works?
Regards,
/Daniel
-
3. Re: Simple Spring 3 example
anastopoulos Aug 11, 2011 8:29 AM (in response to beve)Thanks Daniel for your reply.
I'm just getting an object from JNDI, thus I think I cannot "chose" its type.
I suspected a problem of class version and conflict between "my" jms.jar and the one provided by JBoss. The one in my maven repository is 1.1.
I tried to manually remove the jms.jar from the web-inf/lib of my war and this fixed the problem. Yair, can you check this point in your deployment?
My Maven dependency scope on jms.jar became provided.
Regards,
Giorgio
-
4. Re: Simple Spring 3 example
yairogen Aug 14, 2011 7:59 AM (in response to anastopoulos)Using "HornetQJMSConnectionFactory" did the trick for me.