2012-11-06 122 views
0

Spring上下文:我有駱駝的問題http4端點

<bean id="customRouteA" class="com.xxx.CustomRouteABean" /> 

<camelContext id="solr" xmlns="http://camel.apache.org/schema/spring"> 
    <route> 
     <from uri="activemq:topic:agent" /> 
     <to uri="bean:customRouteA"/> 
    </route> 
</camelContext> 

Java代碼:

public class CustomRouteABean { 

@EndpointInject(uri = "http4://localhost/camel-route-test.php") 
ProducerTemplate producer; 

public void processMessage(@Body String message) { 
    ... 
} 
} 

不斷收到錯誤:

2085 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customRouteA' defined in ServletContext resource [/WEB-INF/application-context.xml]: Initialization of bean failed; nested exception is org.apache.camel.spring.GenericBeansException: Error post processing bean: customRouteA; nested exception is org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: http4://localhost/camel-route-test.php?bridgeEndpoint=true due to: null 

我有另一個bean具有相同設置工作正常,我在這裏錯過了什麼?

回答

0

而你在類路徑上有camel-http4及其依賴的JAR?

+0

是的,這在行家的pom.xml, org.apache.camel 駱駝http4 2.10.2 simonxy

+0

是的,這在行家的pom.xml, org.apache.camel camel-http4 2.10.2 我試圖直接把URI在XML路線,並沒有抱怨: <從URI = 「ActiveMQ的:主題:cd.search.agent」/> <到URI =「http4: //localhost/camel-route-test.php「/> 我有其他的路線,但它們不應該互相影響,對不對? 感謝您的幫助。 – simonxy

+0

事實證明,http4在我的設置中不能很好地工作,當我切換到http時,它工作正常。不知道爲什麼。 – simonxy