[Mapserver-users] MapScript and Servlet

Uchoa uchoa at opengeo.com.br
Wed May 26 17:54:43 EDT 2004


This is a multi-part message in MIME format.
--------------020205000106000500080802
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

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?


--------------020205000106000500080802
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type"
 content="text/html;charset=ISO-8859-15">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi,<br>
<br>
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.<br>
<br>
<b>###### ERROR ######</b><br>
<p><font color="#990000"><b>exception</b></font> </p>
<pre><font color="#990000">javax.servlet.ServletException: Servlet execution threw an exception
</font></pre>
<p><font color="#990000"><b>root cause</b></font> </p>
<pre><font color="#990000">java.lang.UnsatisfiedLinkError: new_mapObj
	edu.umn.gis.mapscript.mapscriptJNI.new_mapObj(Native Method)
	edu.umn.gis.mapscript.mapObj.&lt;init&gt;(mapObj.java:296)
	HelloServlet.doGet(HelloServlet.java:39)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)</font>
</pre>
<br>
<b>####### SERVLET TO TEST ########</b><br>
<font color="#006600"><br>
import  edu.umn.gis.mapscript.*;<br>
import java.io.*;<br>
import javax.servlet.http.*;<br>
import javax.servlet.*;<br>
<br>
public class HelloServlet extends HttpServlet {<br>
  public void doGet (HttpServletRequest req,<br>
                                         HttpServletResponse res)<br>
        throws ServletException, IOException<br>
  {<br>
    try<br>
            {<br>
                System.loadLibrary("mapscript");<br>
                System.err.println("Loaded the Mapscript library");<br>
            }<br>
            catch (UnsatisfiedLinkError e)<br>
            {<br>
                e.printStackTrace();<br>
            }<br>
  <br>
      // mapscript<br>
      mapObj map;<br>
      map = new mapObj ("/var/www/html/itasca/demo.map");<br>
    <br>
        PrintWriter out = res.getWriter();<br>
        out.println("Hello, Brave new World!");<br>
        out.close();<br>
  }<br>
}</font><br>
<pre class="moz-signature" cols="72"><big><big>Anyone can help me?</big></big>

</pre>
</body>
</html>

--------------020205000106000500080802--




More information about the mapserver-users mailing list