X11 error with Java code on Red Hat
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 (which I've just read online could use some system-dependent stuff), 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:
Code:
javax.servlet.ServletException: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. 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: Code:
javax.servlet.ServletException |
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 I bought the upgrade and it works...still don't understand why it would work without the upgrade on one Enterprise Red Hat machine and not another. Oh well. |
instead of spending more money you could have run XVFB as a virtual graphical environment, but then you'd have to have X installed... or you could have downloaded a newer, free JVM from http://java.sun.com/
|
All times are GMT -5. The time now is 07:30 AM. |