[mapserver-users] Java MapScript and Tomcat6 Hanging

Gilbertson, Paul paulbe at ceh.ac.uk
Wed Jul 21 07:41:27 PDT 2010


Good folks,

I am somewhat new to MapServer and MapScript, and I'm trying to do a few experiments with Java Mapscript in order to scope out MapServer's feasibility for a large project.

I've downloaded and installed MS4W 3.0 beta 11, and Netbeans 6.9 with Tomcat 6.0.29 in order to test out Java Mapscript. I created a most basic servlet to serve up simple map tiles, and it works for serial requests. When I try to serve two requests at the same time Tomcat hangs hard.

My map file and Java classes are below:

MAP
  IMAGETYPE      PNG24
  NAME           "nbndemo"
  STATUS         ON
  EXTENT         -12.5 12.5 700000 1300012.5
  SIZE           800 800
  IMAGECOLOR     226 245 255
  CONFIG         "MS_ERRORFILE" "/ms4w/apps/nbndemo/error.txt"
  DEBUG          5

  PROJECTION
    "init=epsg:27700"
  END
 
  LAYER 
    NAME         os250k
    STATUS       ON
    TILEINDEX    "/OSRasterTiles/os_250k/os250k_tindex_srs.shp"
    TILEITEM     "Location"
    TYPE         RASTER
    OFFSITE      71 74 65

    PROJECTION
      "init=epsg:27700"
    END
    EXTENT         -12.5 12.5 700000 1300012.5
  END 
END

public class SPRewriter {
    public synchronized void doLogic(HttpServletRequest request, HttpServletResponse response) throws Exception   
    {
        ServletOutputStream out = response.getOutputStream();
        edu.umn.gis.mapscript.mapObj mo = new mapObj("/ms4w/apps/nbndemo/mapfiles/test.map");

        imageObj image = mo.draw();
        response.setContentType(image.getFormat().getMimetype());
        out.write(image.getBytes());
        image.delete();
        mo.delete();
    }
}

    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            SPRewriter spr = new SPRewriter();
            spr.doLogic(request, response);
        }  catch (Exception e) {
            e.printStackTrace();
        }
    }

Any thoughts why this would hang the moment I try to run parallel requests?

Regards,
Paul Gilbertson



-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.




More information about the MapServer-users mailing list