【问题标题】:spring integration service-activator error弹簧集成服务激活器错误
【发布时间】:2015-10-12 12:42:24
【问题描述】:

我尝试在文件入站通道适配器和 FileSplitter 之间预处理文件。为此,我编写了一个执行该工作的类:\

@MessageEndpoint
public class ReleaseManagerForFlatFile {

    @ServiceActivator
    public Message<?> processFileCounter(Message<?> message) {
        Get the job Done !
        return message;
    }
}

我将它包含在我的 spring 集成配置文件中:

<int-file:inbound-channel-adapter
    directory="D:\Donnees\Dev\workspace-luna\FileAggreg\In" id="fileIn"
    auto-startup="true" channel="channelFile" prevent-duplicates="true">
    <int:poller fixed-rate="60000" />
</int-file:inbound-channel-adapter>
<int:channel id="channelFile" />
<int:service-activator id="releaseManager" input-channel="channelFile" output-channel="channelFileIn" 
    ref="releaseManagerForFlatFile" />
<int:channel id="channelFileIn" />
<int-file:splitter id="splitter" input-channel="channelFileIn" output-channel="channelSplitter" />

但是,当我启动链时,我得到了这个异常:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'releaseManagerControl': Cannot resolve reference to bean 'org.springframework.integration.config.ServiceActivatorFactoryBean#1' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.config.ServiceActivatorFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Target object of type [class org.springframework.integration.endpoint.EventDrivenConsumer] has no eligible methods for handling Messages.
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.config.ServiceActivatorFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Target object of type [class org.springframework.integration.endpoint.EventDrivenConsumer] has no eligible methods for handling Messages.
Caused by: java.lang.IllegalArgumentException: Target object of type [class org.springframework.integration.endpoint.EventDrivenConsumer] has no eligible methods for handling Messages.

我之前写了很多服务激活器,但我从来没有遇到过这个问题...... 上下文:Spring Integration 4.2

【问题讨论】:

    标签: spring-integration


    【解决方案1】:

    我刚刚用你的确切代码进行了测试,没有任何问题。

    [class org.springframework.integration.endpoint.EventDrivenConsumer] 类型的目标对象没有合适的方法来处理消息。

    这意味着您的 releaseManagerForFlatFile bean 不是 ReleaseManagerForFlatFile 实例,而是上下文中的其他一些消费者端点。

    也许你有一个重复的 bean 名称?

    org.springframework 启用 DEBUG 日志记录会有所帮助 - 您可以查看正在处理和连接在一起的 bean 定义。

    【讨论】:

      【解决方案2】:

      我猜你需要像下面这样声明新的 bean

      <bean id="releaseManagerForFlatFile" class="package.name.ReleaseManagerForFlatFile"></bean>
      

      我面临同样的问题,但这对我有用。希望对您有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-11-10
        • 1970-01-01
        • 2013-11-10
        • 1970-01-01
        • 1970-01-01
        • 2013-01-08
        • 2021-05-29
        相关资源
        最近更新 更多