2 Replies Latest reply on Jun 13, 2006 7:39 PM by 807581

    Servlet using Xvfb needs DISPLAY set

      I have a servlet that uses an old version of 3rd party charting package to create PNG images. I am currently migrating this servlet from Tomcat to SJSAS and suffering with the error:
      No X11 DISPLAY variable was set, but this program performed an operation which requires it.

      To work under Solaris in the past, it always needed the virtual frame buffer Xvfb to be running. As an alternative to Xvfb I looked at using Java's new headless functionality:
      I did not have much luck with this, "access denied". Given that I'm using a 3rd party class for doing the chart it was probably a bad idea anyway.

      Thus after going back to running Xvfb I am unable to set the DISPLAY variable programatically:
      For the same reason "access denied"

      It seems to me I need to set the environment variable DISPLAY somewhere within SJSAS. I have SJSAS 8.2 on my PC and we have version 8.1 on the target server. The setting of system properties seems to have changed quite dramatically between these two versions.

      Any ideas ?
        • 1. Re: Servlet using Xvfb needs DISPLAY set
          I didn't put that very clearly did I, sorry.

          I have a servlet that uses JClass Chart to create PNG images.
          On its original installation it runs under Solaris 8 using Xvfb to buffer the images, it produces many PNGs per second.

          Now I am trying to migrate it to a Solaris 9 box using Java 1.5 under SJSAS, it is working with or without Xvfb running but it takes approx 30 seconds per image.

          Using SJSAS under windows it still runs quickly.

          Although Xvfb is supposedly included in Solaris 9 in the directory /usr/openwin/bin
          it was nowhere to be found, so I installed it as per Solaris 8 in /usr/X11R6/bin.

          Xvfb is running as follows:
          /usr/X11R6/bin/Xvfb :999 -screen 0 512x512x8 -fbdir /tmp
          In SJSAS I have configured a system property DISPLAY=localhost:999.0
          I dont think this is correct.

          Since the servlet produces images with or without Xvfb running I have to assume it is limping by without it.

          Any idea how to configure SJSAS such that the servlet starts using Xvfb ?
          • 2. Re: Servlet using Xvfb needs DISPLAY set
            I got the servlet to start using Xvfb by setting DISPLAY in the shell script that starts SJSAS.

            The time taken to create a chart image has dropped from a minute or so to 2 or 3 seconds. I big improvement but still very slow when compared with the old installation running under Tomcat 3. There the same servlet does approx 10 images per second on an equivalent box.