Camel配置Servlet轉發

今天用Camel做了個Servlet接收數據轉發的功能,原本感受挺簡單的.可是在作的過程當中仍是遇到了很多問題. java

1.Camel用的版本是2.6,如今看起來是比較老了,but這個是jdk1.5能支持的最後一個版本了.又不想本身編譯. web

2.路由定義用的springDSL. spring

開始啓動 apache

第一個錯,XML解析失敗.沒有jaxb對應的包................................. api

第二個錯,缺乏activation包.......................... app

總算很多了, svn

第三個錯找不到對應的servlet.明明配的有嘛,猜想是Spring容器啓動的順序比Servlet建立先. ui

還好在官網找到如下內容 this

Sample when using Spring 2.x

When using the Servlet component in a Camel/Spring application it's often required to load the Spring ApplicationContext after the Servlet component has started. This can be accomplished by using Spring'sContextLoaderServletinstead ofContextLoaderListener. In that case you'll need to startContextLoaderServletafter CamelHttpTransportServlet like this: spa

<web-app>

<servlet>

<servlet-name>CamelServlet</servlet-name>

<servlet-class>

org.apache.camel.component.servlet.CamelHttpTransportServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet>

<servlet-name>SpringApplicationContext</servlet-name>

<servlet-class>

org.springframework.web.context.ContextLoaderServlet

</servlet-class>

<load-on-startup>2</load-on-startup>

</servlet>

<web-app>


總算搞定.

啓動正常了.

再發數據,

第四個錯,沒有xstream,孃的就轉發下數據要這麼多包不.

就一個from(「servlet://xml」).to(「http://xxxx.xxxx/ssss」)的路由恁是搞了一下午.

activation-2.2.1.jar
camel-core-2.6.0.jar
camel-http-2.6.0.jar
camel-servlet-2.6.0.jar
camel-spring-2.6.0.jar
commons-codec-1.6.jar
commons-httpclient-3.0.jar
commons-logging.jar
commons-management-1.0.jar
javax.xml.bind.jar
jaxb-impl-2.1-EA1.jar
log4j-1.2.15.jar
spring.jar
src
stax-api-1.0-2.jar
 
相關文章
相關標籤/搜索