Spring integration 为什么返回Transformer null会引发异常?

Spring integration 为什么返回Transformer null会引发异常?,spring-integration,Spring Integration,Transformer因返回null而引发异常。我正在获取消息负载,并在transformer中执行业务逻辑。然后,将响应发送到fileoutput通道。我也尝试过使用.handle方法而不是transformer,但得到的是单向消息异常。 编辑 @Bean IntegrationFlow integrationFlow() { return IntegrationFlows.from(this.sftpMessageSource()).channel(fileInputChannel())

Transformer因返回null而引发异常。我正在获取消息负载,并在transformer中执行业务逻辑。然后,将响应发送到fileoutput通道。我也尝试过使用.handle方法而不是transformer,但得到的是单向消息异常。 编辑

 @Bean
 IntegrationFlow integrationFlow() {
return IntegrationFlows.from(this.sftpMessageSource()).channel(fileInputChannel()).
        handle(service, "callMethod").channel(fileOutputChannel()).
        handle(orderOutMessageHandler()).get();
}

编辑2

[ERROR] 2020-06-14 14:49:48.053 [task-scheduler-9] LoggingHandler - java.lang.AbstractMethodError: Method org/springframework/integration/sftp/session/SftpSession.getHostPort()Ljava/lang/String; is abstract
at org.springframework.integration.sftp.session.SftpSession.getHostPort(SftpSession.java)
at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.getHostPort(CachingSessionFactory.java:295)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.copyFileToLocalDirectory(AbstractInboundFileSynchronizer.java:496)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.copyIfNotNull(AbstractInboundFileSynchronizer.java:400)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.transferFilesFromRemoteToLocal(AbstractInboundFileSynchronizer.java:386)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.lambda$synchronizeToLocalDirectory$0(AbstractInboundFileSynchronizer.java:349)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:437)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:348)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:265)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:66)
at org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource.doReceive(AbstractFetchLimitingMessageSource.java:45)
at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:167)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:250)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:359)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:328)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$null$1(AbstractPollingEndpoint.java:275)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$2(AbstractPollingEndpoint.java:272)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

转换器设计为始终返回应答,因为这是一个转换操作。因此,您不能从方法返回null。得到单向错误可能是因为句柄方法是
void

转换器设计为始终返回应答,因为这是一个转换操作。因此,您不能从方法返回null。得到单向错误可能是因为句柄方法是
void

handle方法可以返回null吗?使用最新代码编辑的代码段。现在我没有得到任何异常,但是我是否需要为handle方法的null返回执行任何额外的逻辑如果您的POJO方法返回null,则流停止在那里:没有要发送到下一个通道的内容-没有更多的交互!听起来不错,谢谢。但是获取以上端口异常(我定义的端口)请显示,您从更新的edit2中获得了什么异常。每次从远程SFTPI拾取文件时都会发生这种情况,handle方法是否可以返回null?使用最新代码编辑的代码段。现在我没有得到任何异常,但是我是否需要为handle方法的null返回执行任何额外的逻辑如果您的POJO方法返回null,则流停止在那里:没有要发送到下一个通道的内容-没有更多的交互!听起来不错,谢谢。但是获取以上端口异常(我定义的端口)请显示,您从更新的edit2中获得了什么异常。每次从远程sftp获取文件时都会发生这种情况