[Mapserver-users] MapScript and Servlet
Sean Gillies
sgillies at frii.com
Thu May 27 20:49:14 PDT 2004
On May 26, 2004, at 3:54 PM, 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?
>
>
Mr. Uchoa,
I'm not a Java expert, but isn't an UnsatisfiedLinkError a sign that
your
libmapscript.so is not being found on your path? Are you setting
LD_LIBRARY_PATH and passing it to Tomcat?
cheers,
Sean
--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies
More information about the MapServer-users
mailing list