“Can’t connect to X11 window server”
IDAutomation Java barcode products need access to the Java.AWT library to perform graphics functions. This problem does not occur on Windows or Macintosh platforms; this is a known issue with Unix, Linux and Java. Most versions of the Java.AWT library on Unix require a functioning X server. The X server and the DISPLAY environment variable also needs to be correctly set. Here are some solutions:
- The best solution is to run Java in headless mode. IDAutomation Java Barcode Products have been modified to be compatible with headless Java as of April 2, 2003. Download the current version of any IDAutomation product with an active Priority Support & Upgrade Subscription.After installing Headless Java, it must be enabled. To enable headless mode on Sun JDK 1.4.1 running on Linux, enter export CATALINA_OPTS=”-DJava.awt.headless=true to the /etc/profile file.
- One of the most common solutions is to install the PJA library, which is free under GNU General Public License.
- The current publicly available version of the PJA libraries is 2.4. The JDK 1.4.1, version 2.4 of the PJA libraries may not work because some libraries were removed or changed in JDK 1.4.1. However, there is a beta release for version 2.5 of the PJA libraries that will work with JDK 1.4.1. The beta for version 2.5 can be downloaded from the same page as version 2.4. One IDAutomation customer has provided instructions for using the PJA libraries on a Solaris 8 platform running WebLogic 8.1at this website.
- PJA (Pure Java AWT toolkit) is a graphics library for drawing graphics developed by eTeks. It is 100% Pure Java and does not use any native graphics resource of the system on which the Java Virtual Machine is running (X Server, for instance). This will permit the same functionality as the native awt libraries without concern for the operating environment. Based on eTeks documentation, only their required jar file will have to be installed and “With PJA, you don’t need to change your Java programs that you expected to run: setting Java.awt system property to com.eteks.awt.PJAToolkit is the only required modification to your program with Java 1.1”. eTeks offers full documentation on how to use their class athttp://www.eteks.com/pja/doc/com/eteks/awt/PJAToolkit.html
- Another solution is to use Xvfb (or X Virtual Frame Buffer). Xvfb is an X server emulator that can run on machines with no display hardware and no physical input devices. It can be found as part of X11 Release 6.4, a version of which is available from XFree86. This has been used successfully on Solaris (Intel) 2.6 running Tomcat as the servlet container generating JPEG images. This website describes how to use Xvfb. After this process is turned on, the DISPLAY variable must be set to route back to local machine.
- Sun’s AWT requires an X server to operate. Set the DISPLAY variable to a functioning X server.
For example: setenv DISPLAY=localhost:0.0 export DISPLAY
- When using JSP with Apache try the following:
add wrapper.env=DISPLAY=system_name:0.0 to jserv.properties
Make sure the system is logged in with a display running and the system has access to the display using the xhost + command.
- Sun’s patch 107078-18 corrects some of the “Can’t connect to X11 server” problems on Solaris.
- On Redhat Linux try this: in an xterm session (shell) type xhost +
- This problem is documented many times in forums at Oracle’s website.
- If an applet error occurs while in headless mode, please refer to the Java.awt.HeadlessException issue. This issue was corrected in the June 2004 release of the IDAutomation Java Barcode Product.
- Please note: This is a Unix and Java issue; not a problem with IDAutomation barcode products. If the above techniques do not solve the problem, please contact the Unix vendor for more information about the problems and how to solve them. IDAutomation lacks the expertise with Unix; the solution can be different for each version of Unix. The IDAutomation barcode servlet code should be treated as any other servlet that needs to create graphic images with the Java.AWT library.