Linux下调用awt中方法问题的解决
网站上的图片突然不能访问了,都成了红叉了,出现类似异常:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.Imaging_005fToWeb_jsp._jspService(Imaging_005fToWeb_jsp.java:106)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
这个问题只会在linux这样的类unix或者unix中,而且调用awt中方法时可能出现(在showimage.jsp中使用了awt),解决办法:
在jboss的启动脚本run.sh中加上这句-Djava.awt.headless=true
# Setup JBoss sepecific properties
JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME -Djava.awt.headless=true"