I am able to remote debug apache nifi custom processor in eclipse (ref:1,2,3). The steps I follow are something like this:
Uncomment below line in apache nifi bootstrap.conf
java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
Start apache nifi
Create new debug configuration in eclipse with host=localhost,port=8000 and select custom processor's project.
So I am able to hover the variables, add watch and do step through etc. However, once I get some hint and want to change some code and quickly try, what can be done? Do I need to change code, rebuild nar, stop apache nifi, put nar in apache nifi lib and then restart apache nifi. Do I have to follow this long path every time I do some code changes? Or I am missing something? I tried by changing code and saving it. But the moment I do Ctrl+S, it shows me unable to hot swap code changes screen:

Yes, we can debug Custom Nifi Processor. Code your custom processor with any code editor, create nar file and copy that nar file to lib directory where your NiFi set-up is there.
Go to the conf directory inside your NiFi set-up and search for the file bootstrap.conf.
Open bootstrap.conf file in any available editor and uncomment the below line
java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
Your can change the port availability as per your system.
Now move into your code editor(IntelliJ here) and open the drop down 'Edit Run/Debug Configurations dialog' on the top right side beside the hammer symbol.
Click on Edit configurations option
Below windows open up

Click on plus sign(+) on top left, a drop down will appear, select the remote

Below screen appears

Configure your port that you have mentioned in bootstrap.conf file in NiFi, suppose we have configured 8000 then we need to change the port to 8000

click on Apply and then OK button
Now place the debug points on the custom class that you have written and then click on debug icon on Nifi on the top right side

You will see the console like below

Now open your Nifi on browser of your choice and then start your custom processor (on browser) and then as soon as your processor starts running, debug point on the IntelliJ will hit and you can start debugging your custom processor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With