Announcement Announcement Module
Collapse
No announcement yet.
Problem with service-activator and SI 2.0.0.M2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with service-activator and SI 2.0.0.M2

    Hi,

    I have come across a problem while testing SI 2.0.0 M2. I have created a simple example project to demonstrate the problem - see attachment.

    I have a class A which has a method myMethod. I have a class B which re-implements this method. I have a service activator which calls this method on a bean of type B.

    Code:
    	<service-activator input-channel="inputChannel" output-channel="nullChannel" ref="processMsg" method="myMethod"/>
    	
    	<beans:bean id="processMsg" class="com.example.B"/>
    When I run the application the following exception is thrown. The application works fine with SI 1.0.3. Can you please confirm that this is an bug and that I am not doing something daft? Thanks.

    Code:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.handler.ServiceActivatingHandler#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.integration.handler.ServiceActivatingHandler]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Found more than one method match for type [interface org.springframework.integration.core.Message]
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:283)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:984)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:886)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    	at com.example.Adapter.main(Adapter.java:17)
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.integration.handler.ServiceActivatingHandler]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Found more than one method match for type [interface org.springframework.integration.core.Message]
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:107)
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)
    	... 14 more
    Caused by: java.lang.IllegalArgumentException: Found more than one method match for type [interface org.springframework.integration.core.Message]
    	at org.springframework.util.Assert.isTrue(Assert.java:65)
    	at org.springframework.integration.handler.MethodInvokingMessageProcessor$1.doWith(MethodInvokingMessageProcessor.java:229)
    	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:455)
    	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:431)
    	at org.springframework.integration.handler.MethodInvokingMessageProcessor.findHandlerMethodsForTarget(MethodInvokingMessageProcessor.java:196)
    	at org.springframework.integration.handler.MethodInvokingMessageProcessor.<init>(MethodInvokingMessageProcessor.java:118)
    	at org.springframework.integration.handler.MethodInvokingMessageProcessor.<init>(MethodInvokingMessageProcessor.java:111)
    	at org.springframework.integration.handler.MethodInvokingMessageProcessor.<init>(MethodInvokingMessageProcessor.java:84)
    	at org.springframework.integration.handler.ServiceActivatingHandler.<init>(ServiceActivatingHandler.java:42)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    	... 16 more

  • #2
    Thank you very much for pointing this out!!!
    You are not doing anything wrong, this is a bug which I just fixed and will be committing soon.
    I opened up a JIRA issue so you can follow up on its progress.
    http://jira.springframework.org/browse/INT-981
    Cheers

    Comment

    Working...
    X