When “Error: java.io.IOException: java.io.IOException: Cannot obtain block length for LocatedBlock” appeared

First of all, check your hadoop data with this command :

hdfs fsck -openforwrite -files -blocks -locations /path/data/that/corrupt | grep ‘OPENFORWRITE: MISSING’

You will recognize the file that currently corrupt, then remove that file if not necessary, like this:

hadoop fs -rm /path/data/that/corrupt

Done. Thank you. :D