I wrote one today HDFS call API The simple procedure of . For ease of invocation , Two static variables are defined in the class . And then run it when it's done ,IDEA" Ruthless " I reported a mistake I haven't seen for a long time ——NullPointerException.
I checked it carefully , I found that I was defining static variables hdfs when , Because you need to throw anomalies , therefore try…catch For a moment , As a result, one is missing from the static code block static…
The solution is simple , Put the missing static Add it to it . then biu For a moment , The program worked perfectly !
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .