java.awt.Color错误 [英] java.awt.Color error

查看:372
本文介绍了java.awt.Color错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Jsp页面:

I have this simple Jsp page:

<%@ page language="java" import="java.awt.Color"%> <%
Color background = Color.white;
%>

哪个失败并出现以下错误:

Which fails with following error:

java.lang.NoClassDefFoundError
    at _text__jsp._jspService(/text.jsp:3)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
    at com.caucho.jsp.Page.subservice(Page.java:506)
    at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
    at com.caucho.server.http.Invocation.service(Invocation.java:315)
    at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
    at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
    at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
    at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
    at java.lang.Thread.run(Thread.java:534)

我正在Resin 2.1.13上运行它.

I'm running it on Resin 2.1.13.

你知道是什么原因造成的吗?

Any idea what's causing this?

推荐答案

不确定该问题.我可以在Tomcat中成功运行您的代码.可能这是树脂特有的问题.或者,就像戴夫(Dave)所说的那样,可能是一个没有意义的问题.

Not sure about the issue. I can run your code successfully in my Tomcat. May be this problem is particular to Resin. Or, as said by Dave, may be a headless issue.

您最好的选择是将图像转换成某种POJO,然后将其吐到浏览器中,或者将其保存在磁盘上的某个位置,然后将其链接到JSP中.如果问题仍然存在,请尝试按戴夫指出的在无头模式下运行.

Your best bet is to convert the image in some POJO and then spit that to the browser, or may be save it somewhere on the disk and then link it in your JSP. If problem persists, try running in headless mode, as Dave pointed out.

此外,重要的是要了解JSP是Web的一种视图技术,并且不得执行这种图形操作.

Moreover, its important to understand that JSP is a view technology for the web, and must not do that kind of graphics manipulation.

这篇关于java.awt.Color错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆