Muito boas dicas para quem precisa utilizar implicitamente o X11 do linux ou qq outro ambiente como solaris por exemplo ... implicito diga-se de passagem usar um java.awt.Font por exemplo.
Fonte do artigo
Several workarounds are known:
1) X Virtual Frame Buffer (Xvfb)
2) Pure Java AWT (PJA)
3) Virtual Network Computing (VNC)
On WinNT and Win2K with JRE 1.3.1, logging onto the console instantiates the window system and the BufferedImage creation succeeds. You must be logged is as the same user that instantiates the servlet container. Installing VNC and running tomcat as a service allows normal operation even when logged out.
On Mac OS X 10.1.4, the OS creates an anonymous instance of the JRE. This fails if the machine enters "sleep" mode, but it works during normal screen-saver operation. I haven't tried VNC in this environemnt.
Under Solaris 2.7 with JRE 1.2.2, VNC allows correct operation as long as the same user starts both tomcat and VNC.
Under RedHat linux 7.1, JRE 1.3.1 and tomcat 4.0.3, vnc-server-3.3.3r2-28 allows correct operation as long as the same user starts both tomcat and VNC. Edit the file /etc/tomcat4/conf/tomcat4.conf to set the DISPLAY variable to the same virtual X session created in /etc/sysconfig/vncservers. You may need to start VNC before starting tomcat.
Under JRE 1.4, setting the "headless" property to true allows JFreeChart to render in the absence of an X11 instance. Ray Mercer reports success on RedHat Linux 7.1, 7.1j & 7.2. I have verified correct operation on Solaris 2.7.20:
For servlets, you can use set the property in the command line that invokes the servlet container:
java -Djava.awt.headless=true ...
In tomcat 4, the catalina.sh script can use an environment setting:
setenv CATALINA_OPTS -Djava.awt.headless=true
Postar um comentário