I had the same problem earlier. I guess that the root of the problem is that,
if you autostart JServ from Apache, then env var DISPLAY will not be handed to
the process in which "java ...." runs. What I did is to manually start JServ
with the following script:
#!/bin/sh
# launch jserv in manual mode
jsdk=/path/to/jsdk.jar
jserv=/path/to/Apache-JServ.jar
props=/path/to/jserv.properties
log=/path/to/jserv.log
classes=$CLASSPATH:$jsdk:$jserv
DISPLAY=yourHostName:0
export DISPLAY
THREADS_FLAG=native
export THREADS_FLAG
/path/to/java -Xms60m -Xmx120m -classpath $classes org.apache.jserv.JServ
$props &> $log
Hope it can be of help. I guess that there might be some tricks that you can
try to let Apache server hand the DISPLAY env to java in autostart mode, but in
my case I just want to write the useful code and my production and development
environment also works more flexible with manual start option.
regards,
-Shaoping
Thad Humphries wrote:
> I'm running JServ 1.0b3 with Apache 1.3.4 on a Sun 2.6 server.
>
> I'm trying the image generation examples in Jason Hunter's book,
> specifically Example 6-1, HelloWorldGraphics.java. This servlet uses AWT
> and Hunter warns that you should either unset or set DISPLAY. I have set
> my DISPLAY to :0.0, exported DISPLAY, ran xhosts +, and restarted Apache.
> But when I run my servlet, I get an internal server error and this in my
> jserv.log:
>
> [23/03/1999 13:21:37:735] (ERROR) ajp11: Servlet Error:
> java.lang.InternalError: Can't connect to X11 window server using ':0.0' as
> the value of the DISPLAY variable.: Can't connect to X11 window server
> using ':0.0' as the value of the DISPLAY variable.
> [23/03/1999 13:21:37:736] (ERROR) an error returned handling request via
> protocol "ajpv11"
>
> I get the same response when I unset DISPLAY.
>
> So, who out there has done this? How do I successfully set DISPLAY such
> that JServ can see it?
>
> --------------------------------------------------------------------------
> Thad Humphries "'Open Systems' means no fences. And
> Software Engineer (aka, Nerd) no fences means no need for Gates."
> Phone: 540/675-3015, ext. 225 - Sun Microsystems
>
> ----------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html/>
> Problems?: [EMAIL PROTECTED]
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]