java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.apache.nifi.bootstrap.RunNiFi.main

394 Views Asked by At

i use intellij idea to run the nifi source code from bootstrap/.../RunNiFi.main("start"): github link, but it get wrong like this: picture here

can you help me ?

thanks

and should i run the code from bootstrap/.../RunNiFi.main("start")?

2

There are 2 best solutions below

1
On

You won't be able to launch a single Java class from your IDE to start NiFi, the classpath won't be setup correctly.

You'll need to run a full build and get the assembly from nifi-assembly/target and then run NiFi from the built assembly by using "bin/nifi.sh start".

You can run it directly from the unpacked assembly target, for example:

cd nifi-assembly/target/nifi-1.6.0-SNAPSHOT-bin/nifi-1.6.0-SNAPSHOT
./bin/nifi.sh start

EDIT: You can still use debugger, but it will be debugging a remote Java application. In NiFi's bootstrap.conf, uncomment the following line and restart NiFi:

#java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

This tells the NiFi JVM to listen for incoming debug requests on port 8000.

In your IDE, create a Remote debugging configuration and connect to localhost port 8000. Your break points should work like normal.

0
On

if you can read chinese, you can read my personal blog link here

I found the methods, if you want remote debug nifi, please follow remote debug link.

if you want local debug, you can follow bellow. (I used Intellij idea in windows to debug)

1.

$ git config --global core.longpaths true $ git config --global core.autocrlf false

  1. open intellij idea to git clone https://github.com/apache/nifi, picture here, set the import configure as default, next... after opened the project, the nifi may get wrong message, just ignore it.

  2. mvn -T 2 clean install -DskipTests

  3. configure debugger picture here, picture here

acknowledge:

nifi quick start link: https://nifi.apache.org/quickstart.html

Running NiFi in Debug mode link: https://cwiki.apache.org/confluence/display/NIFI/Contributor+Guide#ContributorGuide-RunningNiFiinDebugmode