Announcement Announcement Module
Collapse
No announcement yet.
cannot instantiate message-driven-channel-adapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • cannot instantiate message-driven-channel-adapter

    I am receiving the follow stack when i attempt to start my spring container:

    Code:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.jms.ChannelPublishingJmsMessageListener#0': Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    	at dpz.objectfactory.SpringObjectFactory.<init>(SpringObjectFactory.java:18)
    	at dpz.estore.ordercore.Main.main(Main.java:10)
    I am trying to wire it with the following config:

    Code:
    	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    		<property name="brokerURL">
    			<value>tcp://localhost:61616</value>
    		</property>
    	</bean>
    	
    	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    		<property name="concurrentConsumers" value="1"/>
    		<property name="connectionFactory" ref="connectionFactory"/>
    		<property name="destinationName" value="exampleQueue"/>
    	</bean>	
    	
    	<integration:channel id="exampleChannel" />
    	
    	<jms:message-driven-channel-adapter id="jmsIn" container="defaultMessageListenerContainer" channel="exampleChannel"/>
    	
    	<integration:chain input-channel="exampleChannel">
    	
    		<integration:transformer method="transform">
    			<bean class="dpz.estore.ordercore.parser.OrderTransformer" />
    		</integration:transformer>
    		
    		<integration:service-activator method="create" ref="orderManager" />
    		
    	</integration:chain>
    I have also used this one to no avail:

    Code:
    	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    		<property name="brokerURL">
    			<value>tcp://localhost:61616</value>
    		</property>
    	</bean>
    	
    	<integration:channel id="exampleChannel" />
    	
    	<jms:message-driven-channel-adapter id="jmsIn" destination-name="exampleQueue" channel="exampleChannel"/>
    	
    	<integration:chain input-channel="exampleChannel">
    	
    		<integration:transformer method="transform">
    			<bean class="dpz.estore.ordercore.parser.OrderTransformer" />
    		</integration:transformer>
    		
    		<integration:service-activator method="create" ref="orderManager" />
    		
    	</integration:chain>
    This is my first attempt to use spring-integration and I feel a little overwhelmed. Any help would really be appreciated!

  • #2
    Hi,

    Did you compare your configuration with jms sample application - http://git.springsource.org/spring-i...ster/basic/jms ?
    Please attach a source code for your project. That will be faster to figure out what's the problem.

    Krzysiek

    Comment


    • #3
      The main difference I see between my application and the sample is that I am using the new schema/libs:
      Code:
      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:integration="http://www.springframework.org/schema/integration"
      	xmlns:file="http://www.springframework.org/schema/integration/file"
      	xmlns:jms="http://www.springframework.org/schema/integration/jms"
      	xmlns:mail="http://www.springframework.org/schema/integration/mail"
      	xmlns:rmi="http://www.springframework.org/schema/integration/rmi"
      	xmlns:ws="http://www.springframework.org/schema/integration/ws"
      	xsi:schemaLocation="http://www.springframework.org/schema/beans
      			http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      			http://www.springframework.org/schema/integration
      			http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
      			http://www.springframework.org/schema/integration/file
      			http://www.springframework.org/schema/integration/file/spring-integration-file-2.0.xsd
      			http://www.springframework.org/schema/integration/jms
      			http://www.springframework.org/schema/integration/jms/spring-integration-jms-2.0.xsd
      			http://www.springframework.org/schema/integration/mail
      			http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd
      			http://www.springframework.org/schema/integration/rmi
      			http://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.0.xsd
      			http://www.springframework.org/schema/integration/ws
      			http://www.springframework.org/schema/integration/ws/spring-integration-ws-2.0.xsd">
      Copying over the wiring from the sample also produces the same exception:
      Code:
      Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.jms.ChannelPublishingJmsMessageListener#0': Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
      	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
      	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
      	at dpz.estore.ordercore.Main.main(Main.java:37)
      Caused by: java.lang.reflect.MalformedParameterizedTypeException
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)
      	at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)
      	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)
      	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
      	at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:82)
      	at java.lang.Class.getGenericInterfaces(Class.java:794)
      	at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:258)
      	at org.springframework.core.GenericTypeResolver.resolveParameterType(GenericTypeResolver.java:82)
      	at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getWriteMethodParameter(GenericTypeAwarePropertyDescriptor.java:147)
      	at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:129)
      	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:506)
      	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:500)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      There really is no code involved; its just the wiring of the message-driven-channel-adapter that is causing the problem.

      Thank you so much for replying.

      Comment


      • #4
        Maybe its helpful to know that this is the dependency entry in my pom.xml for spring-integration:
        Code:
        		<!-- 
        			Spring integration
        		-->
        		<dependency>
        			<groupId>org.springframework.integration</groupId>
        			<artifactId>spring-integration-jms</artifactId>
        			<version>2.0.4.RELEASE</version>
        		</dependency>

        Comment


        • #5
          I am not able to reproduce your error. For me your configuration is working also with the version 2.0.4.
          I know that it's obvious but did you try 'mvn clean install' and run your project again?

          I took your configuration and I created sample test class for it. Run TestInitialization.java in project Attachment .

          Krzysiek
          Attached Files

          Comment


          • #6
            Thanks Krzysiek,

            Can you tell me what version of Spring you are importing? I am using 3.1.0.M1

            Comment


            • #7
              Since I just started researching SI JMS, I grabbed this test zip and ran the test class TestInitialization.java. The output I had was not an exception, and I assume this means it worked.

              Profit!
              WARN : org.springframework.jms.listener.DefaultMessageLis tenerContainer - Could not refresh JMS Connection for destination 'exampleQueue' - retrying in 5000 ms. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect

              Comment


              • #8
                Same here... trying to determine what is different in my setup.

                Comment


                • #9
                  Got it!

                  It was this import:

                  <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-jms</artifactId>
                  <version>2.5.6</version>
                  </dependency>

                  I had accidentally left it in my pom.xml!

                  Thank you guys so very very much!

                  Comment


                  • #10
                    Originally posted by MacFlecknoe View Post
                    Thanks Krzysiek,

                    Can you tell me what version of Spring you are importing? I am using 3.1.0.M1
                    This example doesn't need this dependency. You can check pom.xml. Usually the best solution is to use latest stable version

                    Krzysiek

                    Comment


                    • #11
                      Originally posted by Wrangler View Post
                      Since I just started researching SI JMS, I grabbed this test zip and ran the test class TestInitialization.java. The output I had was not an exception, and I assume this means it worked.

                      Profit!
                      WARN : org.springframework.jms.listener.DefaultMessageLis tenerContainer - Could not refresh JMS Connection for destination 'exampleQueue' - retrying in 5000 ms. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
                      Originally posted by MacFlecknoe View Post
                      Same here... trying to determine what is different in my setup.
                      It seems that your ActiveMQ is not up and running. Can you open admin app http://localhost:8161/admin/topics.jsp? If yes check your port configuration.

                      Krzysiek

                      Comment


                      • #12
                        Krzysiek,

                        Thanks for all the help! I was using the M1 version simply to test out its caching ability. I reverted back to stable. :-)

                        Comment


                        • #13
                          Krzysiek,

                          I got it running now. As I implied above it looks like I was using an old version of spring-jms in my palm :-P

                          Comment

                          Working...
                          X