Mapscript/Java Tomcat

a j sc0rp10nau at YAHOO.COM.AU
Sun Jun 26 23:08:53 EDT 2005


Hi all,

I've been stuck with a problem for a couple of days
now, and i desperately need any help that I can get.
I've successfully got a map image with some dynamic
points using a simple desktop app. Basically this
small app statically loads the mapscript library,
reads in a map file, adds a couple of points and save
the result image to the disk. 

Now when I do this exact same thing as a Servlet, I
just get the java.lang.UnsatisfiedLinkError:
c:\mapserver\mapscript.dll: Can't find dependent
libraries. 

I'm using Tomcat 5.5.9, Java 1.5, and MapServer 4.4 on
a windows machine. I've set the CLASSPATH and PATH
variables already. I've set the java.library.path to
c:\mapserver but it fails to load the library (or its
dependencies) properly. Here is the top part of the
error:

==== start error ==== 
java.lang.UnsatisfiedLinkError:
C:\mapserver\mapscript.dll: Can't find dependent
libraries
	at java.lang.ClassLoader$NativeLibrary.load(Native
Method)
	at java.lang.ClassLoader.loadLibrary0(Unknown Source)
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
...
...

==== end error ==== 

This is what i do in the servlet:

==== start code =====
import javax.servlet.*;
import javax.servlet.http.*;
import edu.umn.gis.mapscript.*;

public class MapServer extends HttpServlet {
    static
	{
		try
		{
			System.loadLibrary("mapscript");
			System.out.println("Loaded the Mapscript library");
		}
		catch (UnsatisfiedLinkError e)
		{
			e.printStackTrace(System.out);
		}
	}
    protected void processRequest(HttpServletRequest
request, HttpServletResponse response)
    throws ServletException, IOException {

  // do something with the mapObj, etc..
  // mapObj map = new mapObj("path/to/map/file.map");
   }
}  
==== end code ====

As mentioned before, any help with this would be
great, and it is quite urgent, as my deadlines are
approaching. 

tia.
Ajay


Send instant messages to your online friends http://au.messenger.yahoo.com 



More information about the mapserver-users mailing list