groovy - Apache Nifi ExecuteGroovyScript: use FTP client inside script - Stack Overflow

I'm trying to realize inside ExecuteGroovyScript something like:import .apachemons.ftp.FTPClientim

I'm trying to realize inside ExecuteGroovyScript something like:

  import .apachemons.ftp.FTPClient
  import .apachemons.ftp.FTP

  def ftpClient = new FTPClient()

  try{
    ftpClient.connect("host")
    // some logic
  } finally {
    if (ftpClient.isConnected()) {
        try {
            ftpClient.logout()
            ftpClient.disconnect()
        } catch (IOException e) {
            // 
        }
    }
 }

But I receive the exception: Unable to resolve class : .apachemons.ftp.FTPClient

May be there no way to realize FTP connection inside ExecuteGroovyScript ?

I'm trying to realize inside ExecuteGroovyScript something like:

  import .apachemons.ftp.FTPClient
  import .apachemons.ftp.FTP

  def ftpClient = new FTPClient()

  try{
    ftpClient.connect("host")
    // some logic
  } finally {
    if (ftpClient.isConnected()) {
        try {
            ftpClient.logout()
            ftpClient.disconnect()
        } catch (IOException e) {
            // 
        }
    }
 }

But I receive the exception: Unable to resolve class : .apachemons.ftp.FTPClient

May be there no way to realize FTP connection inside ExecuteGroovyScript ?

Share Improve this question asked Mar 25 at 14:26 JellyJelly 1,3325 gold badges26 silver badges58 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The nifi-scripting-nar doesn't include commons-net. You can use @Grab to add the dependency, see my blog post for an example of how to do this.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744189736a4562377.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信