Клиент TCP интеграции Spring выбрасывает исключение «Сокет закрыт во время сборки сообщения» - PullRequest
0 голосов
/ 03 июня 2019

В Kotlin / Java, когда я пытаюсь отправить сообщение bytearray на TCP-сервер и получаю сообщение, я получаю исключение

org.springframework.messaging.MessagingException: Exception while awaiting reply; nested exception is java.io.IOException: Socket closed during message assembly
    at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:189)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:179)
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
    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:453)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:233)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:47)
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:46)

Ниже приведен мой класс конфигурации TCP

@Configuration
class TcpIntegrationConfiguration(
    private val tcpConfigurationProperties: TcpConfigurationProperties
) {

    @Bean
    fun tcpClient(): IntegrationFlow {
        return IntegrationFlows.from(Gateway::class.java)
            .handle(
                Tcp.outboundGateway(
                    Tcp.netClient(
                        tcpConfigurationProperties.host, tcpConfigurationProperties.port)
.soTimeout(tcpConfigurationProperties.timeout)))
.get()
    }
}

Любые ответы / предложения?

1 Ответ

0 голосов
/ 03 июня 2019

Вам нужно показать полную трассировку стека (причину и т. Д.), А также код на стороне сервера.

Но Socket closed during message assembly кажется вполне понятным.

Сервер закрыл сокет безотправив полный ответ;десериализатор по умолчанию ожидает увидеть \r\n для обозначения конца сообщения.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...