2013-03-28 19 views
0

我試圖設置我的應用程序使用Spring Integration(版本2.2.0.RELEASE)來接收文件。 當我啓動Tomcat(部署應用程序)時,出現以下錯誤消息。任何人有一個想法爲什麼?我無法讓FTP使用Spring集成工作

SEVERE: Error configuring application listener of class com.xxxx.aaa.web.mvc.context.CccccContextListener 
java.lang.NoClassDefFoundError: com/xxxx/bbb/application/core/exception/unchecked/InvalidFormatException 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) 
    at java.lang.Class.getConstructor0(Class.java:2699) 
    at java.lang.Class.newInstance0(Class.java:326) 
    at java.lang.Class.newInstance(Class.java:308) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4079) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) 
    at org.apache.catalina.core.StandardService.start(StandardService.java:519) 
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 
Caused by: java.lang.ClassNotFoundException: com.xxxx.bbb.application.core.exception.unchecked.InvalidFormatException 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) 
    ... 20 more 

我相信上面的錯誤信息是紅色的鯡魚。在將spring集成依賴關係添加到pom文件並使用ftp配置文件之前,Tomcat已成功啓動。

我使用Java6和Tomcat6。我的FTP配置文件是:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:int="http://www.springframework.org/schema/integration" 
    xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" 
    xsi:schemaLocation=" 
      http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/integration 
      http://www.springframework.org/schema/integration/spring-integration-2.2.xsd 
      http://www.springframework.org/schema/integration/ftp 
      http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.2.xsd"> 

    <int:channel id="ftpChannel"> 
     <int:queue/> 
    </int:channel> 

    <bean id="ftpClientFactory" 
     class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> 
     <property name="host" value="localhost" /> 
     <property name="port" value="21" /> 
     <property name="username" value="user" /> 
     <property name="password" value="password" /> 
    </bean> 

    <int-ftp:inbound-channel-adapter 
     id="ftpInbound" 
     channel="ftpChannel" 
     filename-pattern="*.csv" 
     session-factory="ftpClientFactory" 
     auto-create-local-directory="true" 
     delete-remote-files="true" 
     remote-directory="/" 
     local-directory="C:/folder/IN"> 
      <int:poller fixed-rate="1000" max-messages-per-poll="15"/> 
    </int-ftp:inbound-channel-adapter> 

</beans> 

我加在POM文件的依賴如下:

<dependency> 
    <groupId>org.springframework.integration</groupId> 
    <artifactId>spring-integration-ftp</artifactId> 
    <version>2.2.0.RELEASE</version> 
</dependency> 

回答

2

其實Spring集成需要彈簧芯版本3.0.5至少,而我是有設置爲3.0.2。一旦我將彈簧核心升級到3.0.5,它就起作用了。