1

I seem to be having some trouble configuring my Spring MVC backend to receive and send TCP messages. Looking at the configuration a user suggests in this question - how to plug a TCP-IP client server in a spring MVC application - I tried to place this configuration into my root-context.xml. However, for all of the tags it displays a message such as:

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-gateway and int:gateway both display cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'int:gateway' (replace int:gateway with int-ip:tcp-outbound-gateway).

Here is my root-context.xml file:

<?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>

What am I doing incorrectly? Also, some general tips as to how I could use Spring to send and receive TCP communications would be appreciated :)

Community
  • 1
  • 1
kibowki
  • 4,206
  • 16
  • 48
  • 74

1 Answers1

1

It appears you don't have the spring-integration-ip and spring-integration-core jars on your classpath. You need to bundle them into your war or otherwise make them available on the classpath according to your app server's requirements.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Of course! How silly. On a side note, on many Spring Integration project I have encountered you seem to have an answer - would it be possible for us to chat in a Stack Overflow chat or some other chat program? I have many more questions that I would really appreciate your input on. – kibowki Nov 14 '14 at 05:19
  • We prefer not to use private communication because, generally, if you have a question, others may have the same question too and asking them in public helps the larger community (and they are searchable). – Gary Russell Nov 14 '14 at 13:46