Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi : groovy: 32: unable to resolve class JSch

Solved Go to solution
Highlighted

Nifi : groovy: 32: unable to resolve class JSch

New Contributor

Hello,

I'm running a groovy script which handles SFTP

My Apache NiFi version  is 1.5.0.3.1.2.0-7

 

My script starts with this:

import com.jcraft.jsch.*

def flowFile = session.get()
if(!flowFile) {
return
}

....

 

When I receive the file to process and move I see them in the queue but also the following is appear in the in the nifi-app.log

2020-01-25 19:00:00,041 ERROR [Timer-Driven Process Thread-8] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=56c17bab-81ba-313c-9a00-aa82d48c3ea0] ExecuteScript[id=56c17bab-81ba-313c-9a00-aa82d48c3ea0] failed to process due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script10025.groovy: 32: unable to resolve class JSch
@ line 32, column 6.
JSch ssh = new JSch()
^

Script10025.groovy: 32: unable to resolve class JSch
@ line 32, column 12.
JSch ssh = new JSch()
^

Script10025.groovy: 33: unable to resolve class Session
@ line 33, column 9.
Session sshSession = ssh.getSession(sftpUser, sftpHost, sftpPort)
^

Script10025.groovy: 35: unable to resolve class Channel
@ line 35, column 10.
Channel channel

 

The script is using the following bundle

org.apache.nifi - nifi-scripting-nar

 

I can find the above bundle here

/hadoop/nifi/work/nar/extensions/nifi-standard-nar-1.5.0.3.1.2.0-7.nar-unpacked

 

 

Could you please suggest what should I check to fix the problem ?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Nifi : groovy: 32: unable to resolve class JSch

New Contributor

Problem is solved

 

The module directory field was incorrect.

View solution in original post

3 REPLIES 3
Highlighted

Re: Nifi : groovy: 32: unable to resolve class JSch

Expert Contributor

Here are the standard steps for debugging scripts that fail in Nifi. 

 

1. Please make sure the script works in general. 

 

2. Then make sure that in your test you are on the same machine with the same rights and such.

 

Usually this suffices, if it really fails we can dig more to search about this kind of problem. 


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'. Also check out my techincal portfolio at https://portfolio.jaheruddin.nl
Highlighted

Re: Nifi : groovy: 32: unable to resolve class JSch

New Contributor

Hello @DennisJaheruddi 

 

Thanks for your suggestions.

 

The scripts works in general. 

Based on the error message I dont think this is problem with rights but I compared the good one with the problematic one.

From OS level perspective

I'm using nifi user to run the nifi process and the user is the owner /hadoop/nifi which is the working directory for nifi and has all the read/write/execute permission.

 

Did you mean other rights and such?

 

Thanks

Highlighted

Re: Nifi : groovy: 32: unable to resolve class JSch

New Contributor

Problem is solved

 

The module directory field was incorrect.

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here