[SPARK-4010][Web UI]Spark UI returns 500 in yarn-client mode

The problem caused by #1966 
CC @YanTangZhai @andrewor14