1
遵循一個簡單的駱駝休息,DSL駱駝休息,DSL請求返回404
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<restConfiguration bindingMode="auto" component="netty4-http" port="8080" host="localhost"/>
<rest path="/mycontext">
<get uri="/foo">
<to uri="direct:fooService"/>
</get>
</rest>
<route>
<from uri="direct:fooService"/>
<to uri="netty4-http:http://localhost:9773/services/foo"/>
</route>
</camelContext>
當調用curl localhost:8080/mycontext/foo
始終與下面的異常返回404:
org.apache.camel.component.netty4.http.NettyHttpOperationFailedException: Netty HTTP operation failed invoking http://localhost:9773/services/foo with statusCode: 404
at org.apache.camel.component.netty4.http.NettyHttpHelper.populateNettyHttpOperationFailedException(NettyHttpHelper.java:160)
at org.apache.camel.component.netty4.http.NettyHttpProducer$NettyHttpProducerCallback.done(NettyHttpProducer.java:111)
at org.apache.camel.component.netty4.NettyProducer$NettyProducerCallback.done(NettyProducer.java:491)
at org.apache.camel.component.netty4.handlers.ClientChannelHandler.channelRead0(ClientChannelHandler.java:189)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
當我採取了數據包捕獲,我看到請求行不正確
GET http://localhost:9773/services/foo HTTP/1.1
,但是當我打的後端直接請求行是GET /services/foo HTTP/1.1
可能有人請幫我找出這個問題
您可以嘗試設置要在'Exchange.HTTP_URI'標頭內調用的URI,或嘗試將'&bridgeEndpoint = true'設置爲屬性。作爲[記錄](http://camel.apache.org/netty4-http.html)駱駝將調用實際的URI之前刪除任何組件屬性。不知道如果這能解決你的問題 –
不幸的是,問題仍然存在:( – user392919