aspose file tools*
The moose likes Java in General and the fly likes X11 window server error on linux! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "X11 window server error on linux!" Watch "X11 window server error on linux!" New topic
Author

X11 window server error on linux!

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I've Googled around, but I'm trying to figure out the right way to fix this. We have Java code that uses java.awt (Graphics2D stuff) to generate an image, and we've ported the code over to Linux, but now we're getting this error when our web app tries to generate the image:



What's the best way to fix this? We're running just about the latest release, I think: Red Hat Enterprise Linux 3. Is there a quick and easy way to install something, or what?
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You need to run the basically "Head Less" a document on your options can be found here:
http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html#xvfb


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I Googled around some more, and then I went onto the app server as root and did the following:

#export DISPLAY=localhost:0.0
#xhost +
access control disabled, clients can connect from any host


I'm not sure if that fixed the problem. Now the error changed to the stuff down below, but I don't think it fixed it, because in my app logs I'm seeing NullPointerExceptions when trying to do stuff with the image:



Ok, I'll read up on this headless stuff. I remember seeing a post somewhere that implied that folks were hoping there'd be no need for the headless stuff once the JDK 1.4 came out...
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Headless was introduced in JDK 1.4 prior to that, you needed to run a X Vertual Frame Buffer (xvfb) plus properly export the DISPLAY variable in the Startup Script of your server. Both of these are fairly easy for someone familar with X-Windows.
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I added export CATALINA_OPTS=-Djava.awt.headless=true to /etc/profile and then I typed the following as root:

export DISPLAY=localhost:0.0
xhost +

Doing all of that worked on one Red Hat box, but on another machine that was recently installed from the same Red Hat CD, I'm getting this:

java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:184)
at com.idautomation.linear.BarCode.(com/idautomation/linear/BarCode)


I found this with Google:
http://www.idautomation.com/kb/jdk-1-4-error.html

They say they've fixed the error with their barcode-generating code, but I don't see why I'd have a problem with it on one machine and not another. We got this code from them a couple of years ago, so I don't have a clue what our order number would be or anything like that to get the update. However, how likely is it that their code would give us an error on one machine but not a nearly identical machine? I'm just trying to scrounge around and see if there's anything I can do to try to fix this...
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
Bought the upgraded version...not sure why the old one worked on one Linux box but gave that HeadlessException on a nearly identical Enterprise Red Hat machine. Oh well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: X11 window server error on linux!