Umberto,

  Indeed, there was an extra mapscript.jar in the Tomcat share/lib directory. I've changed it's content and now everything is working perfectly.  I really appreciated your help, thanks a lot.

  You should keep the mapObj.setMappath test for the next source release. It may help people who have the same problem.

Best regards,

Vilson

Umberto Nicoletti wrote:
Jose',
I have compiled latest mapserver from CVS and built java mapscript
with swig 1.3.29.
I changed one of the examples as follows:

Index: examples/DrawMap.java
===================================================================
RCS file: /data2/cvsroot/mapserver/mapscript/java/examples/DrawMap.java,v
retrieving revision 1.5
diff -U3 -r1.5 DrawMap.java
--- examples/DrawMap.java       24 May 2006 08:26:49 -0000      1.5
+++ examples/DrawMap.java       3 Oct 2006 06:45:40 -0000
@@ -27,6 +27,9 @@
       }

    mapObj map = new mapObj(args[0]);
+    String path=map.getMappath();
+    map.setMappath(path);
+    System.out.println("MAPPATH IS="+path);
    //map.getImagecolor().setRGB(153, 153, 204);
    //styleObj st = map.getLayer(1).getClass(0).getStyle(0);
    //st.getColor().setHex("#000000");

and then ran 'make test', which gave no problems.
I suspect you might have an older version of mapscript (either the .so
or the .jar) file lying around. In particular check common/lib of your
tomcat install.

Best regards,
Umberto

On 9/29/06, José Vilson de Mello de Farias <[EMAIL PROTECTED]> wrote:

 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




--
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