I'm using the camel-sftp component to upload a file to an SFTP server. The code is simple:
File source = new File(path);
final String sftpUri = "sftp://" + userId + "@" + serverAddress + "/" + remoteDirectory+"?password="+pwd;
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file:/" + path).to(sftpUri);
}
});
context.start();
Thread.sleep(10000);
context.stop();
However, camel has problems finding the sftp component. Activating the debug logs in Camel it complains:
| 62 - org.apache.camel.camel-core - 2.13.2 | Using ComponentResolver: org.apache.camel.impl.DefaultComponentResolver@29668a43 to resolve component with name: sftp
| 62 - org.apache.camel.camel-core - 2.13.2 | Found component: sftp in registry: null
| 62 - org.apache.camel.camel-core - 2.13.2 | Apache Camel 2.13.2 (CamelContext: camel-16) is shutting down
Any ideas why Camel is behaving this way? In fact, running this code in a standalone application (a Java class with a main
method) works correctly.
And I can see:
11:22:13.237 [main] DEBUG o.a.c.impl.DefaultComponentResolver - Found component: sftp in registry: null
11:22:13.239 [main] DEBUG o.a.c.impl.DefaultComponentResolver - Found component: sftp via type: org.apache.camel.component.file.remote.SftpComponent via: META-INF/services/org/apache/camel/component/sftp
Inside of Karaf, though, only the first line appears, for some reason or other it does not find META-INF/services/org/apache/camel/component/sftp
and as a result the sftp component is not found.