#112 Headless operation not resolved

open
nobody
None
5
2013-01-13
2005-10-27
jscott
No

Hi,

I've read the FAQ. I know setting headless=true in
catalina_opts works well on my Solaris 8 system.

I unfortunately have a sys admin who is refusing to
set the Tomcat server to headless in order to avoid
unforseen consequences for other servlets.

He insists that adding

System.setProperty("java.awt.headless","true")

to my code will solve my problem.

When I try this, the canonical X11 error goes away, but
I get a message from cewolf that it cannot find a
render like so:

java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at
java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
at
java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1031)
at
de.laures.cewolf.util.RenderingHelper.renderException(RenderingHelper.java:64)
at
de.laures.cewolf.CewolfRenderer.logAndRenderException(CewolfRenderer.java:198)
at
de.laures.cewolf.CewolfRenderer.doGet(CewolfRenderer.java:158)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

This is not too surprising, I guess. Its as if the
classloader simply says "Oh, headless! Gotcha. You
won't be needing any of this stuff. No Graphics for you."

I was wondering if there are any cewolf methods or
settings I can specify in the jsp (or my DataProducer)
to modify its Classloader when headless is specified
inside the code like this, rather than from inside
Tomcat's configuration environment?

Thanks,

John

Discussion

  • Brian Fox
    Brian Fox
    2005-10-27

    Logged In: YES
    user_id=805618

    Hrm. That's a tough one. The standard fix has been to set
    tomcat to headless. Jfreechart is using awt to do most of
    the rendering. I would suggest cross posting to the forum on
    jfree.org and see what they say. Cewolf is essentially just
    wraping their classes so the straight library from jfc would
    have the same problems. Please do post back any
    suggestions/solutions you get.