水上裸奔求救:jfreechart问题

zhaoqiubo 2004-12-22 10:34:29
系统redhat linux9.0

我已经把Djava.awt.headless = true加到启动文件里面了,并且我有xWindow;
可是在ApplicationFrame初始化的时候又抛出了异常如下;

java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
at java.awt.Window.<init>(Window.java:266)
at java.awt.Frame.<init>(Frame.java:398)
at javax.swing.JFrame.<init>(JFrame.java:198)
at org.jfree.ui.ApplicationFrame.<init>(ApplicationFrame.java:63)
at com.neusoft.im2.neuchart.Chart.<init>(Chart.java:34)
at com.neusoft.im2.neuchart.Pie3DChart.<init>(Pie3DChart.java:24)
at com.neusoft.im2.neuchart.NeuChart.createChart(NeuChart.java:175)
at oa.fixturemanage._0002foa_0002ffixturemanage_0002fexpense_0005fsearchByYearGKind_0002ejspexpense_0005fsearchByYearGKind_jsp_12._jspService(_0002foa_0002ffixturemanage_0002fexpense_0005fsearchByYearGKind_0002ejspexpense_0005fsearchByYearGKind_jsp_12.java:245)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)

有没有人遇到这种问题,麻烦您,请您告诉我...急啊!!!!!!!!!!!!!
...全文
496 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
along603 2004-12-24
  • 打赏
  • 举报
回复
我的记忆中是在xwindows起程序就该没问题,对吧?
viano 2004-12-23
  • 打赏
  • 举报
回复



-Djava.awt.headless = true

是这样吗? 注意前面有个:“ - ”

setenv DISPLAY :1.0

试一试!

haha7 2004-12-23
  • 打赏
  • 举报
回复
好像是东软的说
zhaoqiubo 2004-12-23
  • 打赏
  • 举报
回复
这个问题谁能帮帮我,我困扰了四个月了。。。。。
zhaoqiubo 2004-12-22
  • 打赏
  • 举报
回复
如果我的服务器ip为192.168.3.175
那么我的命令应该是什么样子的呢?
加到RH的启动脚本中是什么意思?是Redhat Linux的启动脚本!!
VVV_lucky 2004-12-22
  • 打赏
  • 举报
回复
东软的吧?
Eraserpro 2004-12-22
  • 打赏
  • 举报
回复
1.Unix和Linux的图形工作原理与Windows那个弱智的操作系统有很大的不同,如果想使用图形模块,必须让X11的进程启动,最简单的办法是在服务器上启动图形控制台。
另外,在Unix平台上在WAS启动之前必须执行以下的命令:
export DISPLAY=:0.0
xhost +
这2条命令必须在服务器的图形主控台上开命令行窗口执行,执行完以后在相同的窗口上启动WAS。

----------------------------------------------------------

这是上次我问的问题中一个老兄给出的答案,机子不在我手,我没法试,你可以试试看把这两句加到RH的启动脚本里去
zhaoqiubo 2004-12-22
  • 打赏
  • 举报
回复
The error that you get is not even a java error.

Its an environment error.

It is quite obvious by the error that you are running under some kind of
Linux OS or any OS that is Unix based. (If you are not then I have no Idea
what your problem is...Call Sys admin..its there problem.)

I have seen this error many times..It usually happens when you RLOGIN into
someone else's machine, forget to export the DISPLAY back to your machine
and try to run something that pops up a guy.

EVEN IF YOUR NOT RLOGIN'd SOMEWHERE DO THIS.

So here's what you do..

Depending on the shell you are running.
Probably a korn shell or bash shell. I personally like the c shell but
anyway.

1 ) first if you don't know your hostname find out by bringing up a terminal
and typing the word hostname. (how clever of them huh.)

(LETS SAY YOUR HOSTNAME IS Derk)

2) now set your display to you..

under C shell: setenv DISPLAY Derk:0.0
under Korn : export DISPLAY=Derk:0.0

NOTICE THE COLON BETWEEN Derk and the 0.. also notice the 0 <dot> 0... Look
familiar.
这个说了,可是我还是不知道怎么解决? 掩面大哭跪求,咣咣猛磕头!: 谁能帮帮我,不帮我也帮我顶顶帖子好嘛?
zhaoqiubo 2004-12-22
  • 打赏
  • 举报
回复
他也没说解决方法..在哪儿瞎说..
zhaoqiubo 2004-12-22
  • 打赏
  • 举报
回复
有人给我回复这样:
Are you the one that wanted to create an image on the server side w/o having to connect to X11? It's not clear from your question what it is you're trying to do overall.

Tomcat doesn't make Frame's .. so the exception here doesn't make sense, because you're not showing enough of the stack trace to really know where this is coming from.

If you are trying to generate an image on the server for display through a servlet, then creating a Frame is the wrong way to go about it.

It's simple enough to create a BufferedImage, call getGraphics to have a Graphics2D to draw into, do your rendering, and then use ImageIO classes to package the resulting BufferedImage as a PNG to send back to the web browser (or any other format if you don't like PNG for some odd reason).

我没看懂.....怎么办??
虎叔 2004-12-22
  • 打赏
  • 举报
回复
水上裸奔:
有意思!
tom2005 2004-12-22
  • 打赏
  • 举报
回复
up一下
Eraserpro 2004-12-22
  • 打赏
  • 举报
回复
严重关注,同样的问题,我比你还惨,运行程序的机子不在自己手上,连"-Djava.awt.Headless=true"都没机会试!
Eraserpro 2004-12-22
  • 打赏
  • 举报
回复
启动脚本在Linux的root目录下,是隐藏的文件,没有文件名,只有扩展名那种(如.xml,.txt),不过是哪个文件记不清了,你用ls -a看一下好了
zhaoqiubo 2004-12-22
  • 打赏
  • 举报
回复
ding

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧