Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

X11 window server error on linux!

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic