Hi,
When you use AWT classes, those need to connect to your X server.
You can try the solution at this page:
http://www.jinfonet.com/EntSvrHelp/en/None-GUI.htm
Luck!
----- Original Message -----
From: "Ibrahim, Sultan (IndSys,MKT)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 24, 2001 3:22 PM
Subject: Help Need
> Hi All,
> I executed the example program in Servlet Programming By Jason
> Hunter(O'Reillys) book with some modification for my application. It is
just
> try. But it gave this error
>
>
> Error. The server encountered an unexpected condition which prevented it
> from fulfilling the request.
>
> java.lang.InternalError: Can't connect to X11 window server using ':0.0'
as
> the value of the DISPLAY variable.
> at sun.awt.motif.MToolkit.(Compiled Code)
> at java.awt.Toolkit.getDefaultToolkit(Compiled Code)
> at GEIPSGImageLoadServlet.service(Compiled Code)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at
newatlanta.servletexec.ServletExec.processServletRequest(Compiled
> Code)
> at newatlanta.servletexec.ServletExec.ProcessRequest(Compiled
Code)
> at newatlanta.servletexec.ServletExec.ProcessRequest(Compiled
Code)
>
> The same code is working fine in Javawebserver and WebSphere Runtime
> Environment provided by VisualAge Java. It fails when i tried it out with
> Servlet Exec in Netsacpe Enterprise Server3.6
>
> If any one give me some inputs, i am really thankful to u. I think it is
> the problem with environment variables.
>
> Regards,
> Sultan.
>
> Here is the code
>
> import java.io.*;
> import java.awt.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.Properties;
>
> import Acme.JPM.Encoders.GifEncoder;
>
> public class GEIPSGImageLoadServlet extends HttpServlet
> {
>
> Properties defaultProps = null;
> private String ImagePath1 = "";
> private String ImagePath2 = "";
> private String ImagePath3 = "";
> private String ImagePath4 = "";
> private String ImagePath5 = "";
> private String ImagePath6 = "";
> private String ImagePath7 = "";
> private String ImagePath8 = "";
>
>
> public void init(ServletConfig config) throws ServletException
> {
> super.init(config);
> System.out.println("Inside init");
> defaultProps= new Properties();
>
> try
> {
> FileInputStream in = new FileInputStream(
>
getServletConfig().getInitParameter("CONFIG_FILE"));
> defaultProps.load(in);
> in.close();
> ImagePath1 =
(String)defaultProps.get("pattern11");
>
> ImagePath2 = (String)defaultProps.get("slider11");
> ImagePath3 = (String)defaultProps.get("pattern2");
> ImagePath4 = (String)defaultProps.get("slider2");
> ImagePath5 =
(String)defaultProps.get("pattern1A");
> ImagePath6 = (String)defaultProps.get("slider1A");
> ImagePath7 =
(String)defaultProps.get("pattern2A");
> ImagePath8 = (String)defaultProps.get("slider2A");
> System.out.flush();
> }
> catch (Exception e)
> {
> System.out.println ("SERVLET1 IS NOT UP!"+
> e.toString());
> e.printStackTrace();
> }
> }
>
>
> public void service(HttpServletRequest req,HttpServletResponse
res)
> throws
> ServletException, IOException
> {
>
> ServletOutputStream out= res.getOutputStream();
> Frame frame = null;
> Graphics g = null;
>
>
>
> try
> {
> int count=2;
> int type = Integer.parseInt(req.getParameter("type"));
> int position =
> Integer.parseInt(req.getParameter("position"));
> System.out.println("type:" + type);
>
> String path1="";
> String path2="";
> int width = 0;
> int height = 0;
>
> Image images[] = new Image[count];
>
> if (type == 1)
> {
> path1 = req.getRealPath(ImagePath1);
> path2 = req.getRealPath(ImagePath2);
> System.out.println("path details:" + path1);
> System.out.println("path details:" + path2);
> }
> else if (type == 2)
> {
> path1 = req.getRealPath(ImagePath3);
> path2 = req.getRealPath(ImagePath4);
> }
> else if (type == 3)
> {
> path1 = req.getRealPath(ImagePath5);
> path2 = req.getRealPath(ImagePath6);
> }
> else if (type == 4)
> {
> path1 = req.getRealPath(ImagePath7);
> path2 = req.getRealPath(ImagePath8);
> }
>
>
> images[0] = Toolkit.getDefaultToolkit().getImage(path1);
> System.out.println("after 1st image");
> images[1] = Toolkit.getDefaultToolkit().getImage(path2);
> System.out.println("after 2nd image");
>
> frame = new Frame();
> frame.addNotify();
> frame.setBackground(Color.white);
>
> MediaTracker mt = new MediaTracker(frame);
> for (int i=0; i < count; i++)
> {
> mt.addImage(images[i], i);
> }
> try
> {
> mt.waitForAll();
> }
> catch(InterruptedException e)
> {
> getServletContext().log(e, "Interrupted while loading
> image");
> throw new ServletException(e.getMessage());
> }
>
>
> width = images[0].getWidth(frame);
> height = images[0].getHeight(frame);
>
> Image image = frame.createImage(width,height+5);
> g = image.getGraphics();
> g.drawImage(images[0], 0, 0, frame);
> g.drawImage(images[1],position,0,frame);
>
>
>
> res.setContentType("image/gif");
> GifEncoder encoder = new GifEncoder(image, out);
> encoder.encode();
> }
> finally
> {
> if(g != null)
> g.dispose();
> if(frame != null)
> frame.removeNotify();
> }
> }
> }
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html