【问题标题】:tFTPConnection setting password from context not workingtFTPConnection 从上下文设置密码不起作用
【发布时间】:2019-05-14 17:26:12
【问题描述】:

我正在尝试使用上下文变量设置 Talend Open Studio 的 tFTPConnection 组件的密码,但它不起作用。

我遇到了这个异常:

我尝试过使用上下文加载从文件中读取上下文和直接在作业中使用上下文


Exception in component tFTPConnection_1 (read_file_from_sftp_using_context)
com.jcraft.jsch.JSchException: Auth cancel
    at com.jcraft.jsch.Session.connect(Session.java:511)
    at com.jcraft.jsch.Session.connect(Session.java:183)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFTPConnection_1Process(read_file_from_sftp_using_context.java:2062)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFileInputDelimited_3Process(read_file_from_sftp_using_context.java:1776)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFileInputDelimited_2Process(read_file_from_sftp_using_context.java:1067)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.runJobInTOS(read_file_from_sftp_using_context.java:2550)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.main(read_file_from_sftp_using_context.java:2345)
[statistics] disconnected

我预计我的连接会正常工作,但是:(

【问题讨论】:

  • 嗨拉姆。在 tFTPConnection 组件中直接设置密码是否有效?您是否删除了上下文中字符串(或密码类型)变量的双引号?您的密码中有需要转义的特殊字符吗?
  • 嗨@Mo2s,感谢您的提问。我尝试放置和删除双引号,但没有用。我还尝试将上下文设置为密码类型仍然没有缓解。是的,密码有特殊字符,我应该如何转义它们,因为它有(!$ 等)。顺便说一句,如果我在密码字段中硬编码密码,它就可以工作
  • 嗨拉姆。感谢您的反馈意见。使用“\”转义您的特殊字符。以下字符可能需要转义:。让我知情。谢谢。
  • 嗨@Mo2s,我尝试通过在特殊字符前面添加反斜杠来转义密码,例如“密码!”到“密码\!”但它没有用。我在本地机器上设置了我自己的 sftp 服务器,这就是为什么回复的时间比预期的要长
  • 嗨拉姆。感谢您的反馈意见。请执行以下测试:在您的作业中,使用代码“System.out.println(context.your_context_variable);”添加一个 tJava 组件。运行作业并检查堆栈跟踪中的密码。密码正常吗?谢谢。

标签: talend


【解决方案1】:

我找到了包含特殊字符分号(;)的密码传递的解决方案。 我正在阅读this,并找到了这个声明:

注意 "noDatetimeStringSync=true" 周围的引号,因为它 包含字段分隔符 = 字符。

我用分号试过了,它对我有用。

也感谢@Mo2s 的支持。

干杯,拉姆

【讨论】:

    猜你喜欢
    • 2011-11-29
    • 2023-03-06
    • 2013-05-05
    • 1970-01-01
    • 2016-04-30
    • 2015-08-26
    • 2019-01-28
    • 2015-08-25
    • 2014-12-22
    相关资源
    最近更新 更多