[Mapserver-users] MapScript and Servlet

Umberto Nicoletti unicoletti at prometeo.it
Fri May 28 03:36:39 EDT 2004


Try copying mapscript.so in /lib or a patch that ld knows
(/etc/ld.so.conf) and then run ldconfig.

If even that does not work export
LD_LIBRARY_PATH=/path/to/dir/containining/mapscript

before starting tomcat.

The tomcat-user mailing list has some good threads on this issue:
http://marc.theaimsgroup.com/?l=tomcat-user&r=1&w=2

You are running the servlet from Tomcat, aren't you?
HTH,
Umberto

On Wed, 2004-05-26 at 23:54, Uchoa wrote:
> Hi,
> 
> I'm working with RH 8, jakarta-tomcat-5.0.19 and MS 4.0.2. I compile
> MapScript with Java and generate a mapscript.jar and libmapscript.so
> (the last I put in /usr/local/lib). In Eclipse, I import the
> mapscript.jar and I try to run the Servlet below to make a test but I
> get a error.
> 
> ###### ERROR ######
> 
> 
> exception
> 
> javax.servlet.ServletException: Servlet execution threw an exception
> 
> root cause
> 
> java.lang.UnsatisfiedLinkError: new_mapObj
> 	edu.umn.gis.mapscript.mapscriptJNI.new_mapObj(Native Method)
> 	edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:296)
> 	HelloServlet.doGet(HelloServlet.java:39)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> ####### SERVLET TO TEST ########
> 
> import  edu.umn.gis.mapscript.*;
> import java.io.*;
> import javax.servlet.http.*;
> import javax.servlet.*;
> 
> public class HelloServlet extends HttpServlet {
>   public void doGet (HttpServletRequest req,
>                                          HttpServletResponse res)
>         throws ServletException, IOException
>   {
>     try
>             {
>                 System.loadLibrary("mapscript");
>                 System.err.println("Loaded the Mapscript library");
>             }
>             catch (UnsatisfiedLinkError e)
>             {
>                 e.printStackTrace();
>             }
>   
>       // mapscript
>       mapObj map;
>       map = new mapObj ("/var/www/html/itasca/demo.map");
>     
>         PrintWriter out = res.getWriter();
>         out.println("Hello, Brave new World!");
>         out.close();
>   }
> }
> Anyone can help me?
> 




More information about the mapserver-users mailing list