javaspringsocketsjettymina

HTTP/1.1 400 Bad Request in testing Mina/Jetty Setup for Socket Comms


I've defined my jetty Server like this in Spring:

The app runs as a service wrapped by Tanuki Java Service wrapper. So in essence, it is just running while listening to requests from the socket.

<bean id="jetty" class="org.eclipse.jetty.server.Server" init-method="start">
    <constructor-arg name="port" value="${Port}" />
</bean>

And used Mina for endpoint

<bean id="minaFactory" class="org.apache.camel.component.mina2.Mina2Component">
    <constructor-arg index="0" ref="camel"></constructor-arg>
</bean>

<bean id="minaEndpoint" factory-bean="minaFactory" factory-method="createEndpoint">
    <constructor-arg index="0" ref="minaConfig1"></constructor-arg>
</bean>

Then in system.xml,

    <route> 

    <from ref="minaEndpoint" />
        <threads>
            <bean ref="work-to-do" method="work"/>
        </threads>
    </route>

Now, I used Socket Test - https://sourceforge.net/projects/sockettest/?source=typ_redirect

and I can connect to host and port but I keep getting an error when sending requests:

S: {"Action":"Test","Work":"abc"} HTTP/1.1 400 Bad Request Content-Length: 0 Connection: close Server: Jetty(7.2.0.v20101020)

Socket Test


Solution

  • I removed jetty.xml and it worked.