在TOMCAT下运行JSP页面时出现的问题,请教
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: Could not initialize class sun.font.FontManager
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.image_jsp._jspService(image_jsp.java:96)
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)
root cause
java.lang.NoClassDefFoundError: Could not initialize class sun.font.FontManager
sun.java2d.SunGraphicsEnvironment.addDirFonts(Unknown Source)
sun.java2d.SunGraphicsEnvironment.registerFontsInDir(Unknown Source)
sun.java2d.SunGraphicsEnvironment.access$200(Unknown Source)
sun.java2d.SunGraphicsEnvironment$2.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
sun.java2d.SunGraphicsEnvironment. <init> (Unknown Source)
sun.awt.Win32GraphicsEnvironment. <init> (Unknown Source)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
java.awt.image.BufferedImage.createGraphics(Unknown Source)
java.awt.image.BufferedImage.getGraphics(Unknown Source)
org.apache.jsp.image_jsp._jspService(image_jsp.java:67)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
--------------------------------------------
Apache Tomcat/5.0.30
------------------------------------------------------------
原JSP代码为
<%@ page contentType= "image/jpeg "%>
<%@ page import= "java.awt.*,java.awt.image.*,java.util.*,javax.imageio.* "%>
<%!
Color getRandColor(int fc,int bc){
Random random=new Random();