Apache Camel SFTP 在控制台中要求输入用户名和密码。

huangapple go评论66阅读模式
英文:

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

问题

尽管我添加了 usernamepassword,但Camel路由仍然在控制台上要求输入用户名和密码。

依赖项 -

<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路由 -

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);

在控制台运行后,显示如下 -

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

我希望运行应用程序时,usernamepassword 应该自动填入,但不幸的是它没有自动填入。是否有任何解决方案?

英文:

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

答案1

得分: 1

我得到了解决方案。
我传递了一个参数 - preferredAuthentications,设为 password,之后它就能工作了。

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

英文:

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();

答案2

得分: 0

from("sftp://HOST.com:22?username=demo_user&password=demo_password")
   .to("file://src/main/resources");
英文:

You can try

from("sftp://HOST.com:22?username=demo_user&password=demo_password")
   .to("file://src/main/resources");

huangapple
  • 本文由 发表于 2023年3月31日 03:05:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75892068.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定