Search code examples
javaspringspring-bootapache-camel

Apache Camel SFTP is asking for Username and Password in the console


Though I've added a username and password still camel route is asking for a username and password in the console.

Dependency -

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>3.20.1</version>
</dependency>
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-ftp</artifactId>
    <version>3.20.1</version>
</dependency>

Camel Route -

URI uri = new URIBuilder().setScheme("sftp").setHost("HOST.com").setPort(22)
           .setUser("demo_user", "demo_password").build();

from(uri.toString()).to("file://src/main/resources);

After running this in the console it's showing -

19:01:41:158 [main] WARN o.a.c.c.file.remote.SftpOperations - JSCH
Kerberos username: 

I want to run the application and the username & password should automatically take but sadly it's not taking, any solution, please


Solution

  • Finally, I got the solution. I passed a parameter - preferredAuthentications as password and after that, it's working

    URI uri = new URIBuilder().setScheme("sftp").setHost("HOST.com").setPort(22)
           .setUser("demo_user", "demo_password").addParameter("preferredAuthentications", "password").build();