首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Spring集成问题配置TCP通信

用Spring集成问题配置TCP通信
EN

Stack Overflow用户
提问于 2014-11-14 02:51:04
回答 1查看 800关注 0票数 1

我似乎在将Spring后端配置为接收和发送TCP消息时遇到了一些困难。看看用户在这个问题中建议的配置-- how to plug a TCP-IP client server in a spring MVC application --我尝试将这个配置放到我的root-context.xml中。但是,对于所有标记,它都会显示一条消息,如:

Unable to locate Spring NamespaceHandler for element 'int-ip:tcp-outbound-gateway' of schema namespace 'http://www.springframework.org/schema/integration/ip'

int-ip:tcp-outbound-gatewayint:gateway都显示cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'int:gateway' (用int-ip:tcp-outbound-gateway代替int:gateway )。

这是我的root-context.xml文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
                        http://www.springframework.org/schema/integration/ http://www.springframework.org/schema/integration/spring-integration.xsd">

    <!-- Root Context: defines shared resources visible to all other web components -->
    <int:gateway id="gw"
    service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway"
    default-request-channel="input"/>

    <int-ip:tcp-connection-factory id="client"
        type="client"
        host="localhost"
        port="1234"
        single-use="true"
        so-timeout="10000"/>

    <int:channel id="input" />

    <int-ip:tcp-outbound-gateway id="outGateway"
        request-channel="input"
        reply-channel="clientBytes2StringChannel"
        connection-factory="client"
        request-timeout="10000"
        remote-timeout="10000"/>

    <int:transformer id="clientBytes2String"
        input-channel="clientBytes2StringChannel"
        expression="new String(payload)"/>

</beans>

我做错什么了?此外,一些关于如何使用Spring发送和接收TCP通信的一般技巧也将受到欢迎:)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-14 04:09:38

您的类路径上似乎没有spring-integration-ipspring-integration-core jars。您需要将它们捆绑到war中,或者根据应用服务器的要求在类路径上提供它们。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26922119

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档