On Fri, 13 Jan 2006, Wouter Boers wrote: >That was the old way to fix a bug in the JVM I believe. Anyways nowadays you >can pass the following option to the server when starting: >-Djava.awt.headless=true
This page seems to summarize it all ... http://tomcat.apache.org/faq/unix.html <snip> How do I run without an X server and still get graphics? You either need to run headless or run an alternate X-server. Some more information can be found here , here , or here . Or if your are using a JVM 1.4 or better, you can use the system property java.awt.headless=true </snip> >That will prevent the errors mentioned below when you don't have a graphical >shell running on your system. > >Regards, Wouter > >-----Original Message----- >From: Ben Kim [mailto:[EMAIL PROTECTED] >Sent: Friday, January 13, 2006 7:54 AM >To: Tomcat Users List >Subject: Re: Image Scaling Code > > >This may or may not be the case with you. > >I had a similar error (X11, DISPLAY) with an earlier version of tomcat >included in a 3rd party package, on linux. > >After I installed Xvfb (x virtual frame buffer) server rpm, the error went >away. (http://www.xfree86.org/4.0.1/Xvfb.1.html) I think there was a clue in >the error log. > >If you're on Fedora, you can just do yum install xorg-x11-Xvfb or do yum >search Xvfb. I don't think I had to "run" it actually. > >Don't know if it will help you, but just in case. > > >Regards, > >Ben Kim >Developer >http://benix.tamu.edu > >On 1/12/06, Justin Jaynes <[EMAIL PROTECTED]> wrote: >> >> Hello all, >> >> I've written a java class to scale jpeg images. But I can't seem to >> get it to work. Can anyone point me in the right direction? >> >> Here is my code: >> >> >> package com.everybuddystree; >> >> import java.awt.*; >> import java.awt.image.*; >> import java.io.*; >> import javax.imageio.*; >> >> public class ImageScaler { >> >> public ImageScaler() { >> } >> >> public boolean scaleImageByWidth(String fileName, int newWidth) { >> >> File originalImage = new File(fileName); >> try { >> BufferedImage workingBufferedImage = ImageIO.read(originalImage); >> int width = workingBufferedImage.getWidth(); >> int height = workingBufferedImage.getHeight(); >> Image workingImage = workingBufferedImage; >> workingImage = (Image)workingImage.getScaledInstance(newWidth,-1,1); >> BufferedImage finalImage = (BufferedImage)workingImage; >> ImageIO.write(finalImage, "jpg", originalImage); >> >> return true; >> >> } catch (IOException ex){ >> >> return false; >> >> } >> >> } >> >> } >> >> When I run the pass an image to the class using a jsp I get the >> following errors from Tomcat: >> >> >> 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: Can't connect to X11 window server >> using ':0.0' as the value of the DISPLAY variable. >> org.apache.jasper.runtime.PageContextImpl.doHandlePageException( >> PageContextImpl.java:848) >> org.apache.jasper.runtime.PageContextImpl.handlePageException( >> PageContextImpl.java:781) org.apache.jsp.image_jsp._jspService( >> org.apache.jsp.image_jsp:158) >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper. >> java >> :322) >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java >> :314) >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root >> cause >> java.lang.InternalError: Can't connect to X11 window server using ':0.0' >> as the value of the DISPLAY variable. >> sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) >> sun.awt.X11GraphicsEnvironment.access$000(X11GraphicsEnvironment.java >> :53) sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java >> :142) java.security.AccessController.doPrivileged(Native Method) >> sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:13 >> 1) java.lang.Class.forName0(Native Method) java.lang.Class.forName( >> Class.java:164) >> java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment( >> GraphicsEnvironment.java:68) >> sun.awt.X11.XToolkit.<clinit>(XToolkit.java >> :96) java.lang.Class.forName0(Native Method) >> java.lang.Class.forName( >> Class.java:164) java.awt.Toolkit$2.run(Toolkit.java:821) >> java.security.AccessController.doPrivileged(Native Method) >> java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804) >> java.awt.Image.getScaledInstance(Image.java:158) >> com.everybuddystree.ImageScaler.scaleImageByWidth(ImageScaler.java:21) >> org.apache.jsp.image_jsp._jspService(org.apache.jsp.image_jsp:114) >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper. >> java >> :322) >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java >> :314) >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The >> full stack trace of the root cause is available in the Apache >Tomcat/5.5.12 logs. >> >> --------------------------------- >> Apache Tomcat/5.5.12 >> >> >> >> >> >> >> --------------------------------- >> Yahoo! Photos ?Showcase holiday pictures in hardcover Photo Books. You >> design it and we'll bind it! >> > > > >-- >"You can lead a horse to water but you cannot make it float on its back." >~Dakota Jack~ > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > Regards, Ben Kim Developer http://benix.tamu.edu --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]