簡體   English   中英

駱駝servlet監聽地址

[英]Camel servlet to listen address

我有一個監聽ftp地址的程序,每當出現新文件時,它都會將其接收並轉換為pojo。 但是我是從main()方法運行的。 不太舒服

我想創建一個將執行相同操作的servlet,但是我將創建war文件並將其放入TomCat中,並且程序將自行運行,因此我不必運行它。

我已經使用駱駝servlet和spring偵聽器創建了web.xml ,但是我不知道下一步是什么。

這是我現在所擁有的:

我的課:

@Component
public class test extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
            from("ftp://Mike@localhost?noop=true&binary=true").to("file://data");
            }
}

web.xml:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:camel-config.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

駱駝-config.xml中

<context:component-scan base-package="org.apache.camel.spring.issues.contextscan"/>

<camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
    <routeBuilder ref="myBuilder" />
</camelContext>

<bean id="myBuilder" class="test"/>

UPD:

現在我看到我的程序連接到ftp,但是它不復制文件。

我粘貼了日志,我正在獲取http://pastebin.com/2tTf6QmL

我從這個問題中得出的結論是,您正在嘗試使用camel-servlet組件在Web應用程序中初始化駱駝路線。 Camel-servlet組件並不打算這樣做。 如果您將spring與駱駝一起使用,請配置Spring Web上下文加載器org.springframework.web.context.ContextLoaderListener並將spring-camel xml導入spring應用程序上下文文件中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM