Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

AWT and X11 configuration problem

843807Jun 24 2002 — edited Feb 3 2005
Hello,

I am trying to run a J2EE application server and web app on my RedHat 7.2 machine. For certain functionality, the server side application code creates a servlet which creates a JFrame (probably to render some font object). I've learned that this means the JVM needs to access the native window API, in my case an XFree86 server.

Everything is fine if run the application from the command line after running "xhost +" (or something more restrictive) and exporting the DISPLAY variable.

Unfortunately if I try to start the appliation at boot time as a daemon, the Xserver refuses and I get the famous "Can't connect to X11 window server using ':0.0'" error. The X11 server refuses the connection even if I do an "xhost +" before trying to browse the application.

I have tried to make the Xserver more permissive by uncommenting the line in /etc/X11/xdm/Xaccess:

* #any host can get a login window

but this seems to have no effect. I created a /etc/X0.hosts file which contains several combinations of the localhost name.

I have also tried to run xauth in the start script a la "xauth add $DISPLAY . `mcookie`" to no avail...

I'm familiar with some of the options involving Xfvb, PJA and JDK 1.4 headless mode, though I haven't tried any of them yet.

Given that I am indeed running an Xserver on the application server node, it must be configurable to work with java, no?

System info:
XFree86-4.1.0-03
Redhat 7.2 on 550Mhz PIII, 2.4.7-10 kernel
Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed mode)

Partial stack trace of the java exception:
Attributes
javax.servlet.jsp.jspException
Stack Trace
java.rmi.RemoteException:
Error in ejbCreate:; nested exception is: java.lang.InternalError:
Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable. at
...
Caused by: java.lang.Internal
Error: Can't connect to X11 window server using 'localhost:0.0' as
the value of the DISPLAY variable. at s
sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at
sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:126) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:130) at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment
(GraphicsEnvironment.java:62) at java.awt.Window.init(Window.java:223) at
java.awt.Window.(Window.java:267) at java.awt.Frame.(Frame.java:398) at
java.awt.Frame.(Frame.java:363) at
....ReportBean.ejbCreate(ReportBean.java:147) at
....ReportBean_5yy2t2_Impl.ejbCreate
(ReportBean_5yy2t2_Impl.java:112)
...

What is my next step? If any one has Linux, X11 or Java expertise to share, I would greatly appreciate your help.

Andy


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2005
Added on Jun 24 2002
4 comments
364 views