我正在尝试使用apache骆驼将文件从服务器发送到远程邮箱。 我为用户生成了ssh密钥,并将公共密钥与remotehost上的邮箱相关联。我正在使用私钥连接到邮箱文件夹。当我使用像CyberDuck这样的sftp客户端时,我能够连接到邮箱并传输文件。
@Override
public void configure() throws Exception{
from("file:/myfolder/")
.to("sftp://remote_host//mailbox_folder?username=username&" +
"privateKeyFile=private_key_file")
.log(LoggingLevel.INFO,"file transferred successfully")
.end();
}
我在项目中具有以下依赖项:
compile group: 'org.apache.camel', name: 'camel-spring-boot-starter', version: "2.20.1"
compile group: 'org.apache.camel', name: 'camel-quartz', version: "2.20.1"
compile group: 'org.apache.camel', name: 'camel-ftp-starter', version: "2.20.1"
compile group: 'com.jcraft', name: 'jsch', version: '0.1.55'
compile group: 'org.apache.camel', name: 'camel-ftp', version: "2.20.1"
我遇到以下错误:
2020-07-29 14:04:38.004 | ERROR | SpringApplication | Application startup failed
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[sftp://remote_host//mailbox_folder?username=username&privateKeyFile=private_key_file] <<< in route: Route(route1)[[From[file:/my_folder/]] -> [O... because of Failed to resolve endpoint: sftp://remote_host//mailbox_folder?privateKeyFile=private_key_file&username=username due to: No component found with scheme: sftp
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1831) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) ~[camel-spring-2.20.1.jar:2.20.1]
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174) ~[camel-spring-2.20.1.jar:2.20.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at com.example.apache-sftp.main(DataPublisher.java:24) [main/:?]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[sftp://remote_host//mailbox_folder?username=username&privateKeyFile=private_key_file] <<< in route: Route(route1)[[From[file:/my_folder/]] -> [O... because of Failed to resolve endpoint: sftp://remote_host//mailbox_folder?privateKeyFile=private_key_file&username=username due to: No component found with scheme: sftp
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1298) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1148) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3727) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.20.1.jar:2.20.1]
... 16 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sftp://remote_host//mailbox_folder?privateKeyFile=private_key_file&username=username due to: No component found with scheme: sftp
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:769) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:219) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:115) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:121) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:549) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:510) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:226) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1295) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1148) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3727) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168) ~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.20.1.jar:2.20.1]
... 16 more
2020-07-29 14:04:38.004 | INFO | AnnotationConfigEmbeddedWebApplicationContext | Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3c947bc5: startup date [Wed Jul 29 14:04:33 CDT 2020]; root of context hierarchy
我在这里想念什么?
答案 0 :(得分:0)
当我进行多次全新构建(使用gradle)并且由于某些奇怪的原因而重新启动计算机后,问题得以解决