今天測(cè)試驗(yàn)證碼,出現(xiàn)了如圖的錯(cuò)誤

java.awt.geom.Rectangle2D$Float[x=0.0,y=-46.411133,w=31.738281,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0
java.awt.geom.Rectangle2D$Float[x=17.24421,y=-46.411133,w=40.893555,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0
java.awt.geom.Rectangle2D$Float[x=39.462715,y=-46.411133,w=40.893555,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0
java.awt.geom.Rectangle2D$Float[x=61.681206,y=-46.411133,w=34.79004,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0
java.awt.geom.Rectangle2D$Float[x=80.583496,y=-46.411133,w=33.740234,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0
} with fonts {java.awt.Font[family=Dialog,name=Bell MT,style=bold,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=italic,size=50]
java.awt.Font[family=Dialog,name=Bell MT,style=plain,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=plain,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=bold,size=50]
} versus image width = 110, height = 100
at com.octo.captcha.image.gimpy.GimpyFactory.getImageCaptcha(GimpyFactory.java:84)
at com.octo.captcha.engine.image.ImageCaptchaEngine.getNextCaptcha(ImageCaptchaEngine.java:73)
at com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaService.java:156)
at com.octo.captcha.service.AbstractManageableCaptchaService.generateCountTimeStampAndStoreCaptcha(AbstractManageableCaptchaService.java:342)
at com.octo.captcha.service.AbstractManageableCaptchaService.generateAndStoreCaptcha(AbstractManageableCaptchaService.java:331)
at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:83)
at com.octo.captcha.service.image.AbstractManageableImageCaptchaService.getImageChallengeForID(AbstractManageableImageCaptchaService.java:62)
at com.pcitc.ecmall.international.user.util.ImageValidateCode.imageValidateCode(ImageValidateCode.java:34)
at com.pcitc.ecmall.international.user.controller.RegisterMultilingualController.initValidateCode(RegisterMultilingualController.java:318)
at sun.reflect.GeneratedMethodAccessor517.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
字體的問題,翻看日志,分析日志,
下面三行報(bào)錯(cuò)代碼:
java.awt.Font[family=Dialog,name=Bell MT,style=bold,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=italic,size=50]
java.awt.Font[family=Dialog,name=Bell MT,style=plain,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=plain,size=50]
java.awt.Font[family=Dialog,name=Credit valley,style=bold,size=50]
然后把name的三個(gè)字體在windows下找到,放到centos下,在/usr/share/fonts/ 下創(chuàng)建三個(gè)目錄,分別把三個(gè)字體的文件存放進(jìn)去,然后執(zhí)行 fc-cache 重新加載字體;
[root@bogon fonts]# pwd
/usr/share/fonts
[root@bogon fonts]# ls
arial lyx tahoma Verdana
[root@bogon fonts]# fc-cache
問題解決,如果自己的電腦上找不到字體,去百度然后下載下來