【发布时间】:2018-12-06 08:40:56
【问题描述】:
我正在尝试使用 sftp 连接到 ftp 服务器,但似乎无法连接。 连接或凭据没有错误
骆驼上下文.xml
<route>
<from id="_from1" uri="sftp://user@localhost:22/data/test/user?noop=true&password=XXXXXX"/>
<log id="_log1" message="downloading ${file:name}"/>
<to id="_to1" uri="file:ftpclient"/>
</route>
我已经添加了依赖:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
</dependency>
日志如下:
[ Thread-4] RawBuilder INFO Copy thread finished.
[mel.test.blueprint.Main.main()] Activator INFO Camel activator starting
[mel.test.blueprint.Main.main()] Activator INFO Camel activator started
[ Blueprint Extender: 1] BlueprintContainerImpl INFO Bundle sftp_connect/1.0.0.SNAPSHOT is waiting for namespace handlers [http://camel.apache.org/schema/blueprint]
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO Attempting to start CamelContext: _context1
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO Apache Camel 2.21.0.fuse-710018-redhat-00001 (CamelContext: _context1) is starting
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO StreamCaching is enabled on CamelContext: _context1
[ Blueprint Event Dispatcher: 1] ManagedManagementStrategy INFO JMX is enabled
[ Blueprint Event Dispatcher: 1] DefaultManagementAgent INFO ManagementAgent detected JVM system properties: {org.apache.camel.jmx.createRmiConnector=true}
[KTOP-980NI68:1099/jmxrmi/camel] DefaultManagementAgent INFO JMX Connector thread started and listening at: service:jmx:rmi:///jndi/rmi://DESKTOP-980NI68:1099/jmxrmi/camel
[ Blueprint Event Dispatcher: 1] DefaultStreamCachingStrategy INFO StreamCaching in use with spool directory: C:\Users\Lenovo\AppData\Local\Temp\camel\camel-tmp-81aa83b2-0e29-4496-a4b9-17a9ff951952 and rules: [Spool > 128K body size]
[ Blueprint Event Dispatcher: 1] SftpEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well
[ Blueprint Event Dispatcher: 1] SftpEndpoint INFO Using default memory based idempotent repository with cache max size: 1000
[ Blueprint Event Dispatcher: 1] SftpOperations INFO Known host file not configured, using user known host file: C:\Users\Lenovo/.ssh/known_hosts
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO Route: _route1 started and consuming from: sftp://user@localhost:/data/test/user?&noop=true&password=xxxxxx
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO Total 1 routes, of which 1 are started
[ Blueprint Event Dispatcher: 1] BlueprintCamelContext INFO Apache Camel 2.21.0.fuse-710018-redhat-00001 (CamelContext: _context1) started in 1.320 seconds
任何帮助将不胜感激。
编辑:
当我将 JSCH 日志级别设置为它提供的信息时:
[ Blueprint Event Dispatcher: 1] SftpOperations INFO JSCH -> Connection established
【问题讨论】:
-
那么 /data/test/user 中有文件吗?他们没有消费,对吧?
-
路径中有文件,只是不消耗
-
日志显示一切正常,这很奇怪。该路线是否有可能已经消耗了文件?因为您使用 noop=true 导致使用内存中的幂等存储库阻止消费已经使用的文件。
-
我已经在我的路线中输入了日志,如果使用它应该会显示在日志中,对吗?
-
您是否创建了 sftp 用户并正确提供了主目录? uri 中的路径在技术上是 sftp 用户主目录的相对路径。
标签: maven apache-camel sftp jbossfuse blueprint-osgi