centos中验证码使用字体报错

报错

Cannot load from short array because “sun.awt.FontConfiguration.head“ is null

原因

系统缺少相应的字体。安装相应的字体即可解决

解决方法

yum install fontconfig
fc-cache --force