日期:2014-05-16  浏览次数:20676 次

linux tomcat 验证码无法显示问题

项目在window下能正常显示验证码,但切到linux下无法正常显示,报错如下

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Servlet execution threw an exception
	org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)


root cause 

java.lang.NoClassDefFoundError
	java.lang.Class.forName0(Native Method)
	java.lang.Class.forName(Class.java:164)
	java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
	java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1141)
	java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1131)
	com.jsict.ictmap.web.servlet.AuthImg.doGet(AuthImg.java:37)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.

?在网上google后有说法要在设置 JAVA_OPTIONS=" -Djava.awt.headless=true"
可设了后还是没能解决

后来在 http://www.blogjava.net/java-sunfly/articles/213428.html?找到解决方案,成功解决

在catalina.sh前面 加上 unset DISPLAY 解决


我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html