linux 环境 java web 验证码失效
Posted ThinkMine
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 环境 java web 验证码失效相关的知识,希望对你有一定的参考价值。
访问验证码报错:
2020-07-05 20:09:05.610 ERROR 23483 --- [nio-8877-exec-8] c.z.m.a.c.h.ExceptionHandlerAdvice : Exception:Handler dispatch failed; nested exception is j
ava.lang.UnsatisfiedLinkError: /usr/java/jdk1.8.0_181/jre/lib/i386/libfontmanager.so: libgcc_s.so.1: cannot open shared object file: No such file or directory
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.UnsatisfiedLinkError: /usr/java/jdk1.8.0_181/jre/l
ib/i386/libfontmanager.so: libgcc_s.so.1: cannot open shared object file: No such file or directory
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1053)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
...
2020-07-05 20:11:00.232 ERROR 23483 --- [nio-8877-exec-5] c.z.m.a.c.h.ExceptionHandlerAdvice : Exception:Handler dispatch failed; nested exception is j
ava.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class s
un.awt.X11FontManager
...
在解决过程中尝试了以下方法,但是没效果。
- 在
java
命令后面追加-Djava.awt.headless=true
- 在验证码方法class添加
static {
System.setProperty("java.awt.headless", "true");
}
我的解决办法是在linux中安装以下:
[root@zwz /]# yum install libgcc.i686 --setopt=protected_multilib=false
[root@zwz /]# yum grouplist
[root@zwz /]# yum groupinstall Font
以上是关于linux 环境 java web 验证码失效的主要内容,如果未能解决你的问题,请参考以下文章