You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Krishna Kishore Thotakura <ki...@itsc.uah.edu> on 2001/06/02 00:05:23 UTC

Re: AW: servlet error..

Ralf,
 There is X server running on the machine running the WEb Server. I'm running
Red Hat 7.0. The servlet runs fine when i am logged onto the WEb server m/c. 

I think that the Servlet is able to access the X-Server while i am logged in but
it is unable to access it after i log out. 

Please let me know if i need to make any changes in the configuration files
of X11-library in order to allow, tomcat-java process that i started in the
background, to access the X-Server.

thanks.



"Tuukk4 |[:)<-<| p4s4n3n" wrote:
> 
> hei
> Java AWT really needs X (Stupid) to run but using Pure Java AWT (can be found at http://www.eteks.com/pja/en/) you can make it go away:)
> I have used this for pruduct succesfully.. before it i was sooo frustrated
> 
> Tuukka
> 
> ps. eteks server is slow:P
> 
> ---
> --Me olemme keskella jotain. jossa olemme totaalisen ulkopuolisia--
> 
> On Wed, 30 May 2001 08:51:45
>  Ralph Einfeldt wrote:
> >The AWT classes need an x-server to work with images.
> >
> >Can it be that there isn't one running, when this error happens ?
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Krishna Kishore Thotakura [mailto:kishore@itsc.uah.edu]
> >> Gesendet: Mittwoch, 30. Mai 2001 01:05
> >> An: tomcat-user@jakarta.apache.org
> >> Betreff: servlet error..
> >>
> >>
> >> Hi,
> >>  i am trying to write an image to the outputstream of a
> >> servlet. The image is
> >> actually obtained from an invisible awt Canvas.
> >> I'm using Jimi package to encode the Image into JPEG format
> >> and writing this
> >> out to the ServletOutputStream. Sometimes this works fine and
> >> i see a nice
> >> image in the browser but at times, i get the following error:
> >> ----in tomcat.log----
> >> Xlib: connection to ":0.0" refused by server
> >> Xlib: Invalid MIT-MAGIC-COOKIE-1 key
> >>
> >> ----in browser ---
> >> Error: 500
> >> Location: /wms/servlet/WmsServlet
> >> Internal Servlet Error:
> >>
> >> java.lang.NoClassDefFoundError
> >>      at java.lang.Class.forName0(Native Method)
> >>      at java.lang.Class.forName(Class.java:120)
> >>      at java.awt.Toolkit$2.run(Toolkit.java:498)
> >>      at java.security.AccessController.doPrivileged(Native Method)
> >>      at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:489)
> >>      at java.awt.Component.getToolkitImpl(Component.java:657)
> >>      at java.awt.Component.getToolkit(Component.java:641)
> >>      at java.awt.Component.createImage(Component.java:2265)
> >>      at stt.View.ViewJava3D.initMem(ViewJava3D.java:190)
> >>      at stt.View.ViewJava3D.(ViewJava3D.java:214)
> >>      at stt.Display.DisplayManager.initView(DisplayManager.java:126)
> >>      at stt.Display.DisplayManager.(DisplayManager.java:64)
> >>      at sttx.Display.GeoDisplayManager.(GeoDisplayManager.java:79)
> >>      at WmsServlet.init(WmsServlet.java:49)
> >>
> >> Any comments,suggestions,explanations would be greatly appreciated.
> >>
> >
> 
> Get 250 color business cards for FREE!
> http://businesscards.lycos.com/vp/fastpath/

-- 
Krishna Kishore Thotakura.
Work 256 961 7818
Home 256 837 9927

Sinking X11 from AWT - Re: AW: servlet error..

Posted by David Crooke <da...@convio.com>.
This is a well known bug in AWT / Swing. An alternative to changing the Java library is to use something to sink that errant X11 connection -
we use Xvnc for this purpose. Check back post by me on this list or jserv-user for details.

http://www.uk.research.att.com/vnc/

Krishna Kishore Thotakura wrote:

> Ralf,
>  There is X server running on the machine running the WEb Server. I'm running
> Red Hat 7.0. The servlet runs fine when i am logged onto the WEb server m/c.
>
> I think that the Servlet is able to access the X-Server while i am logged in but
> it is unable to access it after i log out.
>
> Please let me know if i need to make any changes in the configuration files
> of X11-library in order to allow, tomcat-java process that i started in the
> background, to access the X-Server.
>
> thanks.
>
> "Tuukk4 |[:)<-<| p4s4n3n" wrote:
> >
> > hei
> > Java AWT really needs X (Stupid) to run but using Pure Java AWT (can be found at http://www.eteks.com/pja/en/) you can make it go away:)
> > I have used this for pruduct succesfully.. before it i was sooo frustrated
> >
> > Tuukka
> >
> > ps. eteks server is slow:P
> >
> > ---
> > --Me olemme keskella jotain. jossa olemme totaalisen ulkopuolisia--
> >
> > On Wed, 30 May 2001 08:51:45
> >  Ralph Einfeldt wrote:
> > >The AWT classes need an x-server to work with images.
> > >
> > >Can it be that there isn't one running, when this error happens ?
> > >
> > >> -----Ursprüngliche Nachricht-----
> > >> Von: Krishna Kishore Thotakura [mailto:kishore@itsc.uah.edu]
> > >> Gesendet: Mittwoch, 30. Mai 2001 01:05
> > >> An: tomcat-user@jakarta.apache.org
> > >> Betreff: servlet error..
> > >>
> > >>
> > >> Hi,
> > >>  i am trying to write an image to the outputstream of a
> > >> servlet. The image is
> > >> actually obtained from an invisible awt Canvas.
> > >> I'm using Jimi package to encode the Image into JPEG format
> > >> and writing this
> > >> out to the ServletOutputStream. Sometimes this works fine and
> > >> i see a nice
> > >> image in the browser but at times, i get the following error:
> > >> ----in tomcat.log----
> > >> Xlib: connection to ":0.0" refused by server
> > >> Xlib: Invalid MIT-MAGIC-COOKIE-1 key
> > >>
> > >> ----in browser ---
> > >> Error: 500
> > >> Location: /wms/servlet/WmsServlet
> > >> Internal Servlet Error:
> > >>
> > >> java.lang.NoClassDefFoundError
> > >>      at java.lang.Class.forName0(Native Method)
> > >>      at java.lang.Class.forName(Class.java:120)
> > >>      at java.awt.Toolkit$2.run(Toolkit.java:498)
> > >>      at java.security.AccessController.doPrivileged(Native Method)
> > >>      at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:489)
> > >>      at java.awt.Component.getToolkitImpl(Component.java:657)
> > >>      at java.awt.Component.getToolkit(Component.java:641)
> > >>      at java.awt.Component.createImage(Component.java:2265)
> > >>      at stt.View.ViewJava3D.initMem(ViewJava3D.java:190)
> > >>      at stt.View.ViewJava3D.(ViewJava3D.java:214)
> > >>      at stt.Display.DisplayManager.initView(DisplayManager.java:126)
> > >>      at stt.Display.DisplayManager.(DisplayManager.java:64)
> > >>      at sttx.Display.GeoDisplayManager.(GeoDisplayManager.java:79)
> > >>      at WmsServlet.init(WmsServlet.java:49)
> > >>
> > >> Any comments,suggestions,explanations would be greatly appreciated.
> > >>
> > >
> >
> > Get 250 color business cards for FREE!
> > http://businesscards.lycos.com/vp/fastpath/
>
> --
> Krishna Kishore Thotakura.
> Work 256 961 7818
> Home 256 837 9927


Re: AW: servlet error..

Posted by David Lennartsson <f9...@dd.chalmers.se>.
On Fri, 1 Jun 2001, Krishna Kishore Thotakura wrote:

>  There is X server running on the machine running the WEb Server. I'm running
> Red Hat 7.0. The servlet runs fine when i am logged onto the WEb server m/c. 
> 
> I think that the Servlet is able to access the X-Server while i am logged in but
> it is unable to access it after i log out. 
> 
> Please let me know if i need to make any changes in the configuration files
> of X11-library in order to allow, tomcat-java process that i started in the
> background, to access the X-Server.

I have had the same problem but I think I finally reached a solution. The
important thing is to set DISPLAY and XAUTHORITY in your startup script.

DISPLAY=:0
XAUTHORITY=/root/.Xauthority
export DISPLAY XAUTHORITY

You have to check that XAUTHORITY points at the file written by the
Xserver at startup. We had some problems with Xvnc sometimes putting the
file in the / directory. I think we solved that by specifying -auth
/root/.Xauthority while running vnc.


We have however experienced other problems with our setup (tomcat just
hangs or exits). We have not tracked down the problem yet, however, if you
experience similar things it may be something with the images. I have been
thinking of doing something like http://www.eteks.com/pja/en/ (PJA
Toolkit). Since it is GPL I can't use their code (or can I?) and keep
my. Anyone know about a similar project with another license?


	/david