zoukankan      html  css  js  c++  java
  • word is too tall: try to use less letters, smaller font or bigger background 报错 java程序 验证码不显示

    验证码不现实问题爆发在测试站,还好只是个测试站,有时间让我慢慢研究此问题。

    具体的情况是这样的:

    下午三点多,突然测试人员跟我说,测试站后台的验证码不现实了,也就无法登陆了
    通过询问,是中午吃饭前还是好好的,突然就不能用了。

    紧接着查看tomcat后台日志

    java程序突然报错,报错信息如下:

    [2018-06-27 21:08:15,318] http-bio-8480-exec-1 (ActionInterceptor.java:105) ERROR - Exception className :com.rongdu.web.action.ToolAction
    [2018-06-27 21:08:15,318] http-bio-8480-exec-1 (ActionInterceptor.java:106) ERROR - Exception methodName:validimg
    [2018-06-27 21:08:15,319] http-bio-8480-exec-1 (ActionInterceptor.java:107) ERROR - Exception message :
    com.octo.captcha.CaptchaException: word is too tall: try to use less letters, smaller font or bigger background: text bounds = {text=0438
    java.awt.geom.Rectangle2D$Float[x=0.0,y=-26.076172,w=20.198242,h=38.13672] ascent=26.076172 descent=12.060547 leading=-0.0
    java.awt.geom.Rectangle2D$Float[x=40.198242,y=-26.076172,w=21.632812,h=38.13672] ascent=26.076172 descent=12.060547 leading=-0.0
    java.awt.geom.Rectangle2D$Float[x=81.831055,y=-26.076172,w=20.198242,h=38.13672] ascent=26.076172 descent=12.060547 leading=-0.0
    java.awt.geom.Rectangle2D$Float[x=122.0293,y=-26.076172,w=7.147461,h=38.13672] ascent=26.076172 descent=12.060547 leading=-0.0
    } with fonts {java.awt.Font[family=Dialog,name=Verdana,style=bold,size=26]
    java.awt.Font[family=Dialog,name=Arial,style=italic,size=26]
    java.awt.Font[family=Dialog,name=Verdana,style=italic,size=26]
    java.awt.Font[family=Dialog,name=Tahoma,style=bold,size=26]
    } versus image width = 80, height = 37
    at com.octo.captcha.image.gimpy.GimpyFactory.getImageCaptcha(GimpyFactory.java:79)
    at com.octo.captcha.engine.image.ImageCaptchaEngine.getNextCaptcha(ImageCaptchaEngine.java:73)
    at com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaSe
    ..............................................................................
    ..............................................................................
    报错信息太多,只截取一节;

    这个问题困扰了我四个小时,是突然下午不能访问的,因为这期间测试站上线过一个版本

    经过重启Tomcat无效后,决定回退测试,结果显然意见,依旧是失败,报错,不现实验证码;

    为解决此问题,下班了公司人都走了,我还在公司继续看,因为不解决,影响第二天的测试;

    一直到九点多,都没有找到原因,打电话咨询一个java开发的朋友技术很吊,把报错及问题说了一下,他说遇到过,应该是字体的问题,回头仔细翻看日志,分析日志,发现。。。。
    下面三行报错代码:

    java.awt.Font[family=Dialog,name=Arial,style=italic,size=26]
    java.awt.Font[family=Dialog,name=Verdana,style=italic,size=26]
    java.awt.Font[family=Dialog,name=Tahoma,style=bold,size=26]

    然后把name的三个字体在windows下找到,放到centos下,在/usr/share/fonts/ 下创建三个目录,分别把三个字体的文件存放进去,然后执行 fc-cache 重新加载字体;

    [root@bogon fonts]# pwd
    /usr/share/fonts
    [root@bogon fonts]# ls
    arial lyx tahoma Verdana
    [root@bogon fonts]# fc-cache

    解决;

    技术男一枚,喜欢做技术分享,把学习的过程,以及遇到问题的解决过程都愿意分享给大家,博客中如有不足,请留言或者联系博主,感谢。 邮箱: sijiayong000@163.com Q Q: 601566386
  • 相关阅读:
    OpenGL编程 基础篇(二)Sierpinski垫片
    PAT1045. Favorite Color Stripe
    OpenGL编程 基础篇(一)
    百练1145:Tree Summing
    百练1745:Divisibility
    百练1321:棋盘问题
    Scrapy架构及其组件之间的交互
    MongoDB快速入门
    Redis快速入门
    Memcache所有方法及参数详解
  • 原文地址:https://www.cnblogs.com/winstom/p/9237315.html
Copyright © 2011-2022 走看看