我在 sendGet 方法中定义的参数遇到了问题,它从ftp服务器以xml文件的形式接收流。通过将类 SpringIntegrationTransformer 绑定到 Processor.class ,我正在使用 Spring云流。这是我的代码。
@EnableBinding(Processor.class)
public class SpringIntegrationTransformer {
private static Logger logger = LoggerFactory.getLogger(SpringIntegrationTransformer.class);
@Autowired
private PolicyListMapper policyListMapper;
@StreamListener(Processor.INPUT)
@SendTo(Processor.OUTPUT)
public MessageSource<byte[]> sendGet(Message<byte[]> message) throws Exception {
byte[] data=message.getPayload();
logger.info("Got data = " + data);
byte[] processedMessage=processData(data);
return () -> MessageBuilder.withPayload(processedMessage).build();
}
private byte[] processData(byte[] data) {
if (data.length == 0) {
logger.info("Empty data");
return new byte[0];
}
try {
logger.info("Contrat.xml data : " + new String(data, "UTF-8"));
return runEmployeeUnmarshaller(data);
} catch (UnsupportedEncodingException e) {
logger.error("Error processData" + e);
}
return new byte[0];
}
private byte[] runEmployeeUnmarshaller(byte[] data) {
try {
JAXBContext context = JAXBContext.newInstance(PolicyList.class);
ByteArrayInputStream input = new ByteArrayInputStream(data);
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
ClassLoader classLoader = RxJavaTransformer.class.getClassLoader();
InputStream xsdStream = classLoader.getResourceAsStream("policies.xsd");
StreamSource xsdSource = new StreamSource(xsdStream);
Schema schema = sf.newSchema(xsdSource);
Unmarshaller unmarshaller = context.createUnmarshaller();
unmarshaller.setSchema(schema);
PolicyList policyList = (PolicyList) unmarshaller.unmarshal(input);
logger.info("PolicyList data : " + policyList == null ? "not marshalled " : "marshalled");
// TODO Add map struct to convert the object
PolicyListDto policyListDto = policyListMapper.mapObjectToDto(policyList);
byte[] policyListByte = SerializationUtils.serialize(policyListDto);
return policyListByte;
} catch (JAXBException | SAXException e) {
logger.error("Error runEmployeeUnmarshaller" + e);
}
return new byte[0];
}
}
sendGet方法负责从ftp服务器接收流,然后将其转换为 DTO 类 policyListDto ,然后通过 processData将其转换为byte [] strong>方法。
执行该类时,我注意到构建成功,但是当我在春季云中部署微服务并将xml文件放入ftp服务器时,出现以下错误:
> 2018-10-18 12:58:38.408 ERROR 1256 --- [ftp.FTPSTREAM-1]
> o.s.integration.handler.LoggingHandler :
> org.springframework.messaging.MessagingException: Exception thrown
> while invoking
> org.proactive.policy.collector.SpringIntegrationTransformer#sendGet[1
> args]; nested exception is java.lang.IllegalArgumentException: Could
> not serialize object of type: class
> org.proactive.policy.dto.PolicyListDto, failedMessage=GenericMessage
> [payload=byte[2273], headers={amqp_receivedDeliveryMode=PERSISTENT,
> amqp_receivedExchange=FTPSTREAM.ftp, amqp_deliveryTag=6,
> file_name=contrat_valid_TEST_amine - Copie - Copie2.xml,
> deliveryAttempt=3, amqp_consumerQueue=FTPSTREAM.ftp.FTPSTREAM,
> amqp_redelivered=false,
> file_originalFile=\tmp\rxjava\contrat_valid_TEST_amine - Copie -
> Copie2.xml, file_relativePath=contrat_valid_TEST_amine - Copie -
> Copie2.xml, amqp_receivedRoutingKey=FTPSTREAM.ftp,
> id=cb05aca3-6202-0ac7-d027-e95b468909fe,
> amqp_consumerTag=amq.ctag-GZZjbfJ-TFeQ8VYiDaCypw,
> contentType=application/octet-stream, timestamp=1539863915387}] at
> org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:63)
> at
> org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
> at
> org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158)
> at
> org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
> at
> org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132)
> at
> org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105)
> at
> org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
> at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445)
> at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394)
> at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181)
> at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160)
> at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
> at
> org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
> at
> org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:203)
> at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$1100(AmqpInboundChannelAdapter.java:60)
> at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.lambda$onMessage$0(AmqpInboundChannelAdapter.java:214)
> at
> org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
> at
> org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180)
> at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:211)
> at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414)
> at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337)
> at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324)
> at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303)
> at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817)
> at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801)
> at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77)
> at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042)
> at java.lang.Thread.run(Thread.java:748) Caused by:
> java.lang.IllegalArgumentException: Could not serialize object of
> type: class org.proactive.policy.dto.PolicyListDto at
> org.proactive.utils.SerializationUtils.serialize(SerializationUtils.java:34)
> at
> org.proactive.policy.collector.SpringIntegrationTransformer.runEmployeeUnmarshaller(SpringIntegrationTransformer.java:84)
> at
> org.proactive.policy.collector.SpringIntegrationTransformer.processData(SpringIntegrationTransformer.java:54)
> at
> org.proactive.policy.collector.SpringIntegrationTransformer.sendGet(SpringIntegrationTransformer.java:41)
> at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181)
> at
> org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114)
> at
> org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55)
> ... 27 more Caused by: java.io.NotSerializableException:
> org.proactive.policy.dto.PolicyListDto at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> org.proactive.utils.SerializationUtils.serialize(SerializationUtils.java:32)
> ... 36 more
>
> 2018-10-18 12:58:38.409 WARN 1256 --- [ftp.FTPSTREAM-1]
> o.s.a.r.r.RejectAndDontRequeueRecoverer : Retries exhausted for
> message (Body:'[B@7914e278(byte[2273])' MessageProperties
> [headers={file_name=contrat_valid_TEST_amine - Copie - Copie2.xml,
> file_originalFile=\tmp\rxjava\contrat_valid_TEST_amine - Copie -
> Copie2.xml, contentType=application/octet-stream,
> file_relativePath=contrat_valid_TEST_amine - Copie - Copie2.xml},
> contentType=application/octet-stream, contentLength=0,
> receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false,
> receivedExchange=FTPSTREAM.ftp, receivedRoutingKey=FTPSTREAM.ftp,
> deliveryTag=6, consumerTag=amq.ctag-GZZjbfJ-TFeQ8VYiDaCypw,
> consumerQueue=FTPSTREAM.ftp.FTPSTREAM])
>
> org.springframework.messaging.MessagingException: Exception thrown
> while invoking
> org.proactive.policy.collector.SpringIntegrationTransformer#sendGet[1
> args]; nested exception is java.lang.IllegalArgumentException: Could
> not serialize object of type: class
> org.proactive.policy.dto.PolicyListDto at
> org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:63)
> ~[spring-cloud-stream-2.0.1.RELEASE.jar!/:2.0.1.RELEASE] at
> org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:158)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:203)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$1100(AmqpInboundChannelAdapter.java:60)
> ~[spring-integration-amqp-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.lambda$onMessage$0(AmqpInboundChannelAdapter.java:214)
> [spring-integration-amqp-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
> [spring-retry-1.2.2.RELEASE.jar!/:na] at
> org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180)
> [spring-retry-1.2.2.RELEASE.jar!/:na] at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:211)
> [spring-integration-amqp-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181] Caused by:
> java.lang.IllegalArgumentException: Could not serialize object of
> type: class org.proactive.policy.dto.PolicyListDto at
> org.proactive.utils.SerializationUtils.serialize(SerializationUtils.java:34)
> ~[proactive-utils-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT] at
> org.proactive.policy.collector.SpringIntegrationTransformer.runEmployeeUnmarshaller(SpringIntegrationTransformer.java:84)
> ~[classes!/:0.0.1-SNAPSHOT] at
> org.proactive.policy.collector.SpringIntegrationTransformer.processData(SpringIntegrationTransformer.java:54)
> ~[classes!/:0.0.1-SNAPSHOT] at
> org.proactive.policy.collector.SpringIntegrationTransformer.sendGet(SpringIntegrationTransformer.java:41)
> ~[classes!/:0.0.1-SNAPSHOT] at
> sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source) ~[na:na]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[na:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498)
> ~[na:1.8.0_181] at
> org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55)
> ~[spring-cloud-stream-2.0.1.RELEASE.jar!/:2.0.1.RELEASE] ... 27
> common frames omitted Caused by: java.io.NotSerializableException:
> org.proactive.policy.dto.PolicyListDto at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> ~[na:1.8.0_181] at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> ~[na:1.8.0_181] at
> org.proactive.utils.SerializationUtils.serialize(SerializationUtils.java:32)
> ~[proactive-utils-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT] ... 36 common
> frames omitted
>
> 2018-10-18 12:58:38.410 WARN 1256 --- [ftp.FTPSTREAM-1]
> s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message
> listener failed.
>
> org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException:
> Listener threw exception at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:1506)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1417)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042)
> [spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> java.lang.Thread.run(Thread.java:748) [na:1.8.0_181] Caused by:
> org.springframework.messaging.MessageDeliveryException: failed to send
> Message to channel 'FTPSTREAM.ftp.FTPSTREAM.errors'; nested exception
> is
> org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException:
> Retry Policy Exhausted at
> org.springframework.integration.support.utils.IntegrationUtils.wrapInDeliveryExceptionIfNecessary(IntegrationUtils.java:163)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:475)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:394)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:181)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:160)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:98)
> ~[spring-messaging-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at
> org.springframework.integration.support.ErrorMessagePublisher.publish(ErrorMessagePublisher.java:164)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer.recover(ErrorMessageSendingRecoverer.java:83)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.retry.support.RetryTemplate.handleRetryExhausted(RetryTemplate.java:512)
> ~[spring-retry-1.2.2.RELEASE.jar!/:na] at
> org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:351)
> ~[spring-retry-1.2.2.RELEASE.jar!/:na] at
> org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180)
> ~[spring-retry-1.2.2.RELEASE.jar!/:na] at
> org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:211)
> ~[spring-integration-amqp-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] ... 8 common
> frames omitted Caused by:
> org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException:
> Retry Policy Exhausted at
> org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer.recover(RejectAndDontRequeueRecoverer.java:45)
> ~[spring-rabbit-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at
> org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder$3.handleMessage(RabbitMessageChannelBinder.java:513)
> ~[spring-cloud-stream-binder-rabbit-2.0.1.RELEASE.jar!/:2.0.1.RELEASE]
> at
> org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:224)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:180)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] at
> org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:445)
> ~[spring-integration-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE] ... 21
> common frames omitted Caused by:
> org.springframework.amqp.AmqpRejectAndDontRequeueException:
> org.springframework.messaging.MessagingException: Exception thrown
> while invoking
> org.proactive.policy.collector.SpringIntegrationTransformer#sendGet[1
> args]; nested exception is java.lang.IllegalArgumentException: Could
> not serialize object of type: class
> org.proactive.policy.dto.PolicyListDto, failedMessage=GenericMessage
> [payload=byte[2273], headers={amqp_receivedDeliveryMode=PERSISTENT,
> amqp_receivedExchange=FTPSTREAM.ftp, amqp_deliveryTag=6,
> file_name=contrat_valid_TEST_amine - Copie - Copie2.xml,
> deliveryAttempt=3, amqp_consumerQueue=FTPSTREAM.ftp.FTPSTREAM,
> amqp_redelivered=false,
> file_originalFile=\tmp\rxjava\contrat_valid_TEST_amine - Copie -
> Copie2.xml, file_relativePath=contrat_valid_TEST_amine - Copie -
> Copie2.xml, amqp_receivedRoutingKey=FTPSTREAM.ftp,
> id=cb05aca3-6202-0ac7-d027-e95b468909fe,
> amqp_consumerTag=amq.ctag-GZZjbfJ-TFeQ8VYiDaCypw,
> contentType=application/octet-stream, timestamp=1539863915387}] ...
> 27 common frames omitted Caused by:
> org.springframework.messaging.MessagingException: Exception thrown
> while invoking
> org.proactive.policy.collector.SpringIntegrationTransformer#sendGet[1
> args]; nested exception is java.lang.IllegalArgumentException: Could
> not serialize object of type: class
> org.proactive.policy.dto.PolicyListDto at
> org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:63)
因此,我假设错误来自 sendGet 的参数,我将 byte [] 类型修改为 Message ,如下所示上面的代码,但没有成功。
感谢您的帮助。感谢您解决我的问题。
答案 0 :(得分:0)
看起来像您的代码中的问题...
> java.lang.IllegalArgumentException: Could not serialize object of
> type: class org.proactive.policy.dto.PolicyListDto at
> org.proactive.utils.SerializationUtils.serialize(SerializationUtils.java:34)
>...
> Caused by: java.io.NotSerializableException:
> org.proactive.policy.dto.PolicyListDto at
将来;发布堆栈跟踪而不进行修改;格式错误时很难读取(使用Command-K只需缩进4个字节)。