Greetings,

  I've compiled a Mapserver from the latest CVS code (Sept 29) and I'm having some problems with Java Mapscript.

  My system had been running fine until
this afternoon, when I compiled a new Mapserver from CVS code. I had to compile a new Swig version before I could start.

  The Mapserver compilation was fine, and I didn't get any erros. My goal was the Java Mapscript, wich was sucessfully compiled and tested with "make test". After I had deployed and restarted the Tomcat it figured out that one of my example codes wasn't working anymore. The code is very simple, please take a look :

  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    log.trace("doGet - request:" + req);
    try {
      PrintWriter p = resp.getWriter();

      mapObj mapa = new mapObj("/home2/java/tomcat/webapps/mapserver_wms/mapas/rio_grande_do_sul.map");
      mapa.setMappath("/home2/java/tomcat/webapps/mapserver_wms/mapas/shapes_rio_grande_do_sul");
   
      imageObj image = mapa.draw();

      File arqMapa = File.createTempFile("mapa", ".png", new File("/home2/java/tomcat/webapps/mapserver_wms/image"));
      log.debug("createTempFile " + arqMapa.getAbsolutePath());

      arqMapa.deleteOnExit();
      image.save(arqMapa.getAbsolutePath(), mapa);

      resp.setContentType("text/html");
      resp.getWriter().println("<img src="" + arqMapa.getName() +  ">");
    }
    catch (Exception e) {
      log.error(e.getLocalizedMessage(), e);
    }
  }


After I executed the code above on Firefox, the following error was showed :
javax.servlet.ServletException: set_mapObj_mappath
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:293)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

root cause

java.lang.UnsatisfiedLinkError: set_mapObj_mappath
    edu.umn.gis.mapscript.mapscriptJNI.set_mapObj_mappath(Native Method)
    edu.umn.gis.mapscript.mapObj.setMappath(mapObj.java:195)

After some tests I found that the problem had been caused by mapa.setMappath code. It seems Swig wasn't able to create a proper mapscript.jar/libmapscript.so. I checked the mapscript_wrap.c and the corresponding method to mapa.setMappath was called Java_edu_umn_gis_mapscript_mapscriptJNI_mapObj_1mappath_1set. Although I have definitely no experience with Swig, those numbers "1" in method name doesn't look ok. Is it ok? Could be the Swig the responsible for this error?

If I remove the mapa.setMappath, everything works fine and my map is shown in the browser.

I included some info about my Mapserver and system. By the way, I've compiled every component of Mapserver instead of using Linux defaults.


compiled packages (we haven't used any RPMs, all packages were manually compiled/installed)
libpng-1.2.12
freetype-2.2.1
zlib-1.2.3
gd-2.0.33
jpegsrc.v6b
tiff-3.8.2
libgeotiff-1.2.1
PDFlib-Lite-6.0.3
proj-4.4.9
curl-7.15.4
geos-2.2.3
gdal-1.3.2
swig-1.3.29

Mapserver's configure
./configure --prefix=/home2/mapserver --without-pdf --with-threads --with-zlib=/home2/mapserver/zlib --with-png=/home2/mapserver/libpng --with-tiff=/home2/mapserver/libtiff --with-jpeg=/home2/mapserver/libjpeg --with-freetype=/home2/mapserver/freetype --with-proj=/home2/mapserver/proj4 --with-geos=/home2/mapserver/geos/bin/geos-config --with-gd=/home2/mapserver/gd --with-ogr=/home2/mapserver/gdal/bin/gdal-config --with-gdal=/home2/mapserver/gdal/bin/gdal-config --with-curl-config=/home2/mapserver/libcurl/bin/curl-config --with-wfs --with-wcs --with-wmsclient --with-wfsclient --with-php=/usr/include/php

Linux
Linux dgtad 2.6.9-22.EL #1 Mon Sep 19 18:20:28 EDT 2005 i686 athlon i386 GNU/Linux

MAPSERVER_HOME=/home2/mapserver
PROJ_LIB=$MAPSERVER_HOME/proj4/share/proj
LD_LIBRARY_PATH=$LD_LIBRARY_PATH::/home2/mapserver/proj4/lib:/home2/mapserver/gdal/lib:/home2/mapserver/geos/lib:/home2/mapserver/libcurl/lib:/home2/mapserver/libpng/lib:/home2/mapserver/libjpeg/lib:/home2/mapserver/libtiff/lib:/home2/mapserver/libgeotiff/lib:/home2/mapserver/ogdi/lib:/home2/mapserver/freetype/lib:/home2/mapserver/gd/lib:/home2/mapserver/zlib/lib:/home2/mapserver/proj4/share/proj
:$MAPSCRIPT_HOME
MAPSCRIPT_HOME=$MAPSERVER_HOME/mapscript
PATH=/usr/java/jre/bin:/usr/java/jdk/bin:$MAPSCRIPT_HOME

Java
JRE_HOME=/usr/java/jre
JAVA_HOME=/usr/java/jdk
JDBC_HOME=/usr/java/jdbc
CATALINA_HOME=/usr/java/tomcat

java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)

Tomcat
Using CATALINA_BASE:   /usr/java/tomcat
Using CATALINA_HOME:   /usr/java/tomcat
Using CATALINA_TMPDIR: /usr/java/tomcat/temp
Using JRE_HOME:       /usr/java/jre
Server version: Apache Tomcat/5.5.17
Server built:   Apr 14 2006 02:08:29
Server number:  5.5.17.0
OS Name:        Linux
OS Version:     2.6.9-22.EL
Architecture:   i386
JVM Version:    1.5.0_07-b03
JVM Vendor:     Sun Microsystems Inc.

gcc
gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Swig
SWIG Version 1.3.29
Compiled with g++ [i686-pc-linux-gnu]
Please see http://www.swig.org for reporting bugs and further information


I'd appreciate any help and thanks in advance.

Best regards,

--
José Vilson de Mello de Farias
Analista de Sistemas
SSE - Segurança Pública

DÍGITRO TECNOLOGIA
E-mail: [EMAIL PROTECTED]
Messenger: [EMAIL PROTECTED]
Fone: (0xx48) 3281-7314
Fax: (0xx48) 3281-7000
Site: www.digitro.com.br

Reply via email to