UnsatisfiedDependencyException- Unsatisfied dependency expressed through constructor
Hi
I am using spring-rabbit 1.1.2 and spring-amqp 1.1.2 versions along with spring 3.1.1 versions. When I try to load my config to JBoss7 I am getting the below exception. Could someone please help me?
Code:
2012-12-20 15:35:57,870 ERROR [ContextLoader] Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageFactory' defined in ServletContext resource [/WEB-INF/rabbitmqSenderConfig.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.amqp.rabbit.core.RabbitTemplate]: Could not convert constructor argument value of type [org.springframework.amqp.rabbit.core.RabbitTemplate] to required type [org.springframework.amqp.rabbit.core.RabbitTemplate]: Failed to convert value of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' to required type 'org.springframework.amqp.rabbit.core.RabbitTemplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.amqp.rabbit.core.RabbitTemplate] to required type [org.springframework.amqp.rabbit.core.RabbitTemplate]: no matching editors or conversion strategy found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:702)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850)
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Related configuration part like:
Code:
<!--Amqp template declaration -->
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" message-converter="jsonConverter" routing-key="${system.distributed.queue.sms.whispir}"/>
<!-- Message sender bean declaration -->
<bean id="messageFactory" class="biz.whispir.service.queue.SendRabbitMessages">
<constructor-arg type="org.springframework.amqp.rabbit.core.RabbitTemplate" ref="amqpTemplate"/>
<constructor-arg type="java.lang.String" value="${system.distributed.exchange.name}"/>
<constructor-arg type="org.codehaus.jackson.JsonFactory" ref="jsonFactory"/>
<constructor-arg type="org.springframework.amqp.rabbit.core.RabbitAdmin" ref="rabbitAdmin"/>
</bean>
Many Thanks.