Re: [OpenMap Users] Newbie questions

From: Adam Russell <adam.russell@channing.harvard.edu>
Date: Mon Aug 11 2003 - 16:44:56 EDT

Ha!! That is a fun one.
This provides some explanation and a possible workaround
http://www.caucho.com/support/resin-interest/0009/0367.html
Basically, java.awt needs to have X around in order to work. It does
this by checking the value of the DISPLAY variable to try and connect to
a working X server.
There is a couple of workarounds and I think that sun may have a fix in
the most recent java releases.
I just went with the Xvfb solution(see the above link) and since it
works very well stopped investigating this further.
A google search with keyords like java.awt and Headless will give you a
lot more info too.

Benjamin.May@bookspan.com wrote:

>
> Hrm, well so far so good. I am able to do some basic stuff. For now, I
> am just using a default setting Projection. I can worry about getting
> the position attributes once I am able to just write a file out at all
> ;) When I try to instantiate the ImageServer as in Keith's example, I
> get the following exception:
>
> Exception in thread "main" java.lang.InternalError: Can't connect to
> X11 window server using ':0.0' as the value of the DISPLAY variable.
> at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> at
> sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:54)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:115)
> at
> java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:53)
> at java.awt.Font.initializeFont(Font.java:259)
> at java.awt.Font.<init>(Font.java:293)
> at java.awt.Font.decode(Font.java:773)
> at com.bbn.openmap.layer.LabelLayer.<init>(Unknown Source)
> at com.bbn.openmap.layer.DateLayer.<init>(Unknown Source)
> at java.lang.Class.newInstance0(Native Method)
> at java.lang.Class.newInstance(Class.java:232)
> at com.bbn.openmap.util.ComponentFactory.create(Unknown Source)
> at com.bbn.openmap.image.ImageServer.getLayers(Unknown Source)
> at com.bbn.openmap.image.ImageServer.setProperties(Unknown Source)
> at com.bbn.openmap.image.ImageServer.<init>(Unknown Source)
> at com.bbn.openmap.image.ImageServer.<init>(Unknown Source)
> at Test.getMapAsJPEG(Test.java:47)
> at Test.main(Test.java:27)
> Now, I am trying to save an image without using swing at all, so I am
> confused why the image manager is trying to act as an XWin client. Is
> the imagemanager inherently swing-related? If so I should probably
> chose another way to do this. Thanks again guys!
>
> -----Original Message-----
> *From:* Benjamin.May@bookspan.com [mailto:Benjamin.May@bookspan.com]
> *Sent:* Monday, August 11, 2003 2:52 PM
> *To:* kalphonso@diamonddata.com
> *Cc:* openmap-users@bbn.com
> *Subject:* RE: [OpenMap Users] Newbie questions
>
>
> This is a good start... What class is that in? You have some
> methods (getMapProperties() for instance) which you dont provide
> here. Are the openmap methods? Where are you passing it the
> co-ordinates so it knows what map to draw? Thanks!
>
> Here is the block of code I use to generate a map jpeg from a
> set of properties and a map projection.
>
>
> public byte [] getMapAsJPEG(HttpSession session)
> {
> Properties props = getMapProperties();
>
> ImageServer imageServer = new ImageServer("mapDemo", props);
> com.bbn.openmap.image.SunJPEGFormatter formatter = new
> com.bbn.openmap.image.SunJPEGFormatter();
> formatter.setImageQuality(1.0f);
> imageServer.setFormatter(formatter);
> byte [] imageBytes =
> imageServer.createImage(getMapProjection());
> return imageBytes;
> }
>

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Aug 11 16:45:22 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT