<html>
<body>
Jose,<br><br>
I understand your frustration having gone through this not so long ago
myself.&nbsp; Be sure to read all the previous threads on the subject as
well.<br><br>
OK, from what I understand, there are a few things to check and pardon me
if I am too verbose or do not have enough information on &quot;why&quot;
these items are necessary. I am assuming you are using tomcat on some
sort of U/Linux platform.<br><br>
1) The java class that loads the mapscript library or the jar file that
includes the class that loads the library must be in the
&lt;tomcat-root&gt;/common/lib directory.<br><br>
&nbsp; for example: the jar file I is use - dswllc-mapscript.jar - that
has the JavaMapscript.class (which is shown below and loads the mapscript
library) is located in my &lt;tomcat-root&gt;/common/lib
directory<br><br>
2) As stated in previous threads, you *cannot* have the java class that
loads the mapscript library in the &lt;web-app-root&gt;/WEB-INF/classes
directory.&nbsp; And you cannot have a jar file that includes the class
that loads the library in the &lt;web-app-root&gt;/WEB-INF/lib
directory.<br><br>
&nbsp; for example: I could not place the above mentioned files in my
&lt;web-app-root&gt;/WEB-INF/lib or &lt;web-app-root&gt;/WEB-INF/classes
directories or I would get the &quot;Library already loaded&quot;
error.<br><br>
3) The mapscript.jar file created when compiling the java mapscript for
Mapserver can also be in the &lt;tomcat-root&gt;/common/lib directory (if
you want it available to all web apps under Tomcat), or in your
&lt;web-app-root&gt;/WEB-INF/lib directory.&nbsp; This is the jar file
created when you run make in the
&lt;mapserver-src-root&gt;/mapscript/java directory.&nbsp; Essentially
once you run make in the &lt;mapserver-src-root&gt;/mapscript/java
directory your should copy the mapscript.jar file to the
&lt;tomcat-root&gt;/common/lib or your &lt;web-app-root&gt;/WEB-INF/lib
directory and the libmapscript.so file to a location the system knows to
look for libraries - such as /usr/local/lib<br><br>
&nbsp; for example: In my configuration I copy the mapscript.jar file to
my &lt;tomcat-root&gt;/common/lib directory and my libmapscript.so file
to /usr/local/lib/special<br><br>
4) You should set your environment variable&nbsp; LD_LIBRARY_PATH to the
include the path the to libmapscript.so and/or edit your /etc/lib.so.conf
file to include the path to the llibmapscript.so file - or just place it
in a directory the system already knows to look for libraries - such as
/usr/local/lib<br><br>
Hope that helps.<br><br>
Dan<br><br>
<br>
At 07:11 AM 12/1/2004, Jose Luis Gonzalez wrote:<br>
<blockquote type=cite class=cite cite>I am working in java, with
servlets. I can be able to load the library (I think) but Its says that
another class had already loaded it, because even using the program you
propose me it gives me an UnsatisfiedLinkError.<br>
The great problem is that I can not acceed to the mapserver objects as
you say.<br>
I think the libmapserver.so is not in the correct place.And I included it
in the path, but it seems he doesn't get it.<br>
So if you have any sugestions please tell me.<br>
&nbsp;<br>
thank you<br>
&nbsp;<br>
Jose Luis<br><br>
<b><i>n Barron &lt;dbarron@dswllc.com&gt;</i></b> wrote:<br>

<dl>
<dd>Jose Luis,<br>
<br>

<dd>What is your scenario again?&nbsp; You can load the mapscript library
- and prove it is loaded?&nbsp; Then you cannot create any mapserver
objects?<br><br>

<dd>Please try to use the following files for a simple test.&nbsp; The
first file is the java object that loads the libmapscript.so.&nbsp; The
second is simple jsp file that can be used to create an instance of
JavaMapscript, then just print out its version info. <br><br>

<dd>Dan<br><br>

<dd><tt>&gt;&gt;~~~~~~~~~ File - JavaMapscript.java
~~~~~~~~~~~~~~~~&lt;&lt;<br><br>

<dd>package edu.umn.gis.java.mapscript;<br><br>

<dd>/**<br>

<dd>&nbsp;* Created by user: umberto at unicolet.org<br>

<dd>&nbsp;* Date: May 23, 2004<br>

<dd>&nbsp;* License: GPL<br>

<dd>&nbsp;*/<br><br>

<dd>public class JavaMapscript {<br>

<dd>&nbsp;&nbsp;&nbsp; <br>

<dd>&nbsp;&nbsp;&nbsp; private static JavaMapscript instance =
null;<br><br>

<dd>&nbsp;&nbsp;&nbsp; private JavaMapscript() {<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.loadLibrary(&quot;mapscript&quot;);<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception e)
{<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
e.printStackTrace();<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.err.println(&quot;* error loading native library *&quot;);<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.err.println(&quot;Error is: &quot;+e);<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;
* mapscript native library loaded *&quot;);<br>

<dd>&nbsp;&nbsp;&nbsp; }<br><br>

<dd>&nbsp;&nbsp;&nbsp; public static JavaMapscript getInstance() {<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( instance == null )
{<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
instance = new JavaMapscript();<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return instance;<br>

<dd>&nbsp;&nbsp;&nbsp; }<br>

<dd>}&nbsp;&nbsp; <br><br>
<br>

<dd>&gt;&gt;~~~~~~~~ FILE - test-mapsctipt.jsp
~~~~~~~~~&lt;&lt;<br><br>

<dd>&lt;%@ page import=&quot;edu.umn.gis.mapscript.*&quot;%&gt;<br>

<dd>&lt;%<br>

<dd>&nbsp;&nbsp;&nbsp; out.print(&quot;&lt;br/&gt;loading mapscript
library...&lt;br/&gt;&quot;);<br><br>

<dd>&nbsp;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>

<dd>&nbsp;&nbsp; * Load the libmapscript.so native library just
once<br>

<dd>&nbsp;&nbsp; * JavaMapscript class will ensure it is only loaded
once<br>

<dd>&nbsp;&nbsp;
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/<br>

<dd>&nbsp;&nbsp;
edu.umn.gis.java.mapscript.JavaMapscript.getInstance();<br><br>

<dd>&nbsp;&nbsp;&nbsp; out.print(&quot;&lt;br/&gt;mapscript library
loaded sucessfully...&lt;br/&gt;&quot;);<br>

<dd>&nbsp;<br>

<dd>&nbsp;&nbsp; mapscript ms = new mapscript();<br><br>

<dd>&nbsp;&nbsp;&nbsp; out.print(&quot;&lt;br/&gt;mapscript library
version: &quot; + ms.msGetVersion() + &quot;&lt;br/&gt;&quot;);<br><br>

<dd>%&gt;<br><br>
</tt>
<dd>At 08:11 AM 11/30/2004, Jose Luis Gonzalez wrote:<br><br>
<blockquote type=cite class=cite cite>
<dd>I have wrote this email to the mapserver mailing list, and I do not
obtain any solution. I think you had a similar problem, so could you help
me please.<br>

<dd>I think it could be the libmapscript.so that is not locolized, but it
apears correctly in the paths of my server...so I don't know what is the
problem.(I send you how the paths are set in a .jpg file)<br>

<dd>&nbsp;<br>

<dd>Thank you<br>

<dd>&nbsp;<br>

<dd>Jose Luis<br>

<dd>&nbsp;<br>

<dd>p.d. I have tried with different mapserver instructions like mapObj
map = new mapObj(&quot;test.map&quot;); and I always obtain the same
error.
<dd>I am using mapserver 4.2.4.
<dd>All I wanted to do is to do any simple mapserver instructions to see
that everything works.
<dd>I have tried the demos that apear when you install mapserver, but I
wanted to see it work with my own code and deploying my archives to the
server.
<dd>For example it will be great if i could manage to just draw a .map
file for instance as a response to the client.
<dd>Do you now how to do this, or what easy instrctions I can use to see
if it works?<br>

<dd>&nbsp;
<dd>Thank you<br>

<dd>&nbsp;
<dd>Jose Luis<br>

<dd>n Gillies &lt;sgillies@FRII.COM&gt; wrote:
<dd>On Nov 29, 2004, at 4:26 AM, Jose Luis Gonzalez wrote:<br>

<dd>&gt; --0-82611386-1101727598=:30831
<dd>&gt; Content-Type: text/plain; charset=iso-8859-1
<dd>&gt; Content-Transfer-Encoding: 8bit
<dd>&gt;
<dd>&gt; This is my code:
<dd>&gt; First of all I have this file:
<dd>&gt;
<dd>&gt; package javamaps;
<dd>&gt;
<dd>&gt; public class MapserverLibLoad{
<dd>&gt; public static void loadLibrary() throws UnsatisfiedLinkError{
<dd>&gt; System.loadLibrary(&quot;mapscript&quot;);
<dd>&gt; }
<dd>&gt; }
<dd>&gt;
<dd>&gt; Then this is the principal program, as you see it is a
servlet:
<dd>&gt;
<dd>&gt; import javamaps.*;
<dd>&gt; import edu.umn.gis.mapscript.*;
<dd>&gt; import javax.ejb.*;
<dd>&gt; import javax.xml.parsers.*;
<dd>&gt; import javax.xml.transform.*;
<dd>&gt; import javax.xml.transform.dom.*;
<dd>&gt; import org.w3c.dom.*;
<dd>&gt; import java.sql.*;
<dd>&gt; import javax.sql.*;
<dd>&gt; import javax.naming.*;
<dd>&gt;
<dd>&gt; import javax.servlet.*;
<dd>&gt; import javax.servlet.http.*;
<dd>&gt; import java.io.*;
<dd>&gt; public class test2 extends HttpServlet{
<dd>&gt;
<dd>&gt; InitialContext initialContext=null;
<dd>&gt;
<dd>&gt; static{
<dd>&gt; try{
<dd>&gt; MapserverLibLoad.loadLibrary();
<dd>&gt; }catch(UnsatisfiedLinkError e){
<dd>&gt; e.printStackTrace();
<dd>&gt; System.out.println(&quot;CONTINUE&quot;);
<dd>&gt; }
<dd>&gt; }
<dd>&gt;
<dd>&gt;
<dd>&gt; /
<dd>&gt;
/----------------------------------------------------------------------
<dd>&gt; ------------------------------------------------------
<dd>&gt;
<dd>&gt; private Connection createDatabaseConnection()throws
EJBException{
<dd>&gt; DataSource dataSource;
<dd>&gt; Connection connection;
<dd>&gt; PreparedStatement stmt;
<dd>&gt; try{
<dd>&gt; dataSource = (DataSource)
initialContext.lookup(&quot;jdbc/lbs&quot;);
<dd>&gt; connection= dataSource.getConnection();
<dd>&gt; //System.out.println(&quot;
<dd>&gt; DATABSE:::::&quot;+connection.getMetaData().getUserName());
<dd>&gt; return connection;
<dd>&gt; }catch (SQLException e){
<dd>&gt; throw (new EJBException(e));
<dd>&gt; }catch (NamingException e){
<dd>&gt; throw (new EJBException(e));
<dd>&gt; }
<dd>&gt; }
<dd>&gt;
<dd>&gt;
<dd>&gt;
<dd>&gt; /
<dd>&gt;
/----------------------------------------------------------------------
<dd>&gt; ------------------------------------------------------
<dd>&gt; public void init (ServletConfig cfg){
<dd>&gt; try{
<dd>&gt; System.out.println(&quot;Try to init servlet&quot;);
<dd>&gt; System.out.flush();
<dd>&gt; initialContext= new InitialContext();
<dd>&gt; }catch(Exception e){
<dd>&gt; throw (new EJBException(e));
<dd>&gt; }
<dd>&gt;
<dd>&gt; }//fin init
<dd>&gt;
<dd>&gt; public void service (HttpServletRequest req, HttpServletResponse
res){
<dd>&gt; Connection conexion=null;
<dd>&gt; String imei=null;
<dd>&gt; PrintWriter out=null;
<dd>&gt; Statement orden=null;
<dd>&gt; ResultSet rs=null;
<dd>&gt; String SQL=null;
<dd>&gt;
<dd>&gt; try{ itemObj item = new itemObj();
<dd>&gt; System.out.println(&quot; BIG NAME
<dd>&gt; :&gt;&gt;&quot;+item.getName()+&quot;&lt;&lt;&quot;);
<dd>&gt;
<dd>&gt; conexion=this.createDatabaseConnection();
<dd>&gt; imei=req.getParameter(&quot;IMEI&quot;);
<dd>&gt; out=res.getWriter();
<dd>&gt; SQL=&quot;SELECT * FROM Client WHERE Name=&quot;;
<dd>&gt; SQL=SQL+&quot;'&quot;+imei+&quot;'&quot;;
<dd>&gt; orden=conexion.createStatement();
<dd>&gt; rs=orden.executeQuery(SQL);
<dd>&gt; res.setContentType(&quot;text/html&quot;);
<dd>&gt; out.println(&quot;&quot;);
<dd>&gt; out.println(&quot; &quot;);
<dd>&gt; rs.next();//I move to the first row
<dd>&gt; out.println(&quot;
<dd>&quot;);
<dd>&gt; out.println(&quot;
<dd>&quot;);
<dd>&gt; out.println(&quot;
<dd>&quot;+rs.getString(&quot;Name&quot;));
<dd>&gt; out.println(&quot; &quot;+rs.getString(&quot;Mobile&quot;));
<dd>&gt;
<dd>&gt; out.println(&quot;
&quot;+rs.getString(&quot;Telephone_Number&quot;));
<dd>&gt; out.println(&quot;
<dd>&quot;);
<dd>&gt; while (rs.next()){
<dd>&gt; out.println(&quot;
<dd>&quot;+rs.getString(&quot;Name&quot;));
<dd>&gt; out.println(&quot; &quot;+rs.getString(&quot;Mobile&quot;));
<dd>&gt;
<dd>&gt; out.println(&quot;
&quot;+rs.getString(&quot;Telephone_Number&quot;));
<dd>&gt; out.println(&quot;
<dd>&quot;);
<dd>&gt; }
<dd>&gt; out.println(&quot;&quot;);
<dd>&gt;
<dd>&gt;
<dd>&gt;
<dd>&gt; }//fin try
<dd>&gt; catch (Exception e){
<dd>&gt; System.out.println(e);
<dd>&gt; }catch (Throwable e){
<dd>&gt; System.out.println(&quot;WRONGG POINT&quot;);
<dd>&gt; e.printStackTrace();
<dd>&gt; }finally{
<dd>&gt; try{
<dd>&gt; out.close();
<dd>&gt; rs.close();
<dd>&gt; conexion.close();
<dd>&gt; orden.close();
<dd>&gt; }catch(Exception e){
<dd>&gt; throw (new EJBException(e));
<dd>&gt; }
<dd>&gt;
<dd>&gt; }//fin service
<dd>&gt;
<dd>&gt; }
<dd>&gt; }
<dd>&gt;
<dd>&gt; It seems as like he can't reach the mapserver librarys and I
don't
<dd>&gt; know why.It gives me this error:
<dd>&gt;
<dd>&gt; java.lang.UnsatisfiedLinkError: new_itemObj
<dd>&gt;
<dd>&gt; Can someone help me?
<dd>&gt; Know what I'm doing wrong?
<dd>&gt;
<dd>&gt; Thank you
<dd>&gt;
<dd>&gt; Jose Luis
<dd>&gt;<br>

<dd>Jose Luis,<br>

<dd>1) it is *very* important that you mention which version of
MapServer
<dd>you use! The mapscript module has changed very much from 3.6 to
4.4.<br>

<dd>2) do not try to use itemObj, it is not functional. We use SWIG to
<dd>generate the mapscript wrapper for Java, and it is very permissive,
<dd>with the result that non-functional classes can be accidently
<dd>added to mapscript. I'm going to shut itemObj out of the final 4.4
<dd>release.<br>

<dd>cheers,
<dd>Sean<br>
<br>
<br>

<dd>--
<dd>Sean Gillies
<dd>sgillies at frii dot com
<dd><a href="http://users.frii.com/sgillies" eudora="autourl">http://users.frii.com/sgillies</a><br><br>
</dl><br><br>
<a href="http://es.rd.yahoo.com/mail_es/tagline/mail/image/*http://es.mail.yahoo.com"><img src="http://eur.i1.yimg.com/eur.yimg.com/i/es/mail/mails.gif" width=230 height=80 alt="Nuevo Correo Yahoo!"></a><br><br>
<br><br>
<a href="http://es.rd.yahoo.com/mail_es/tagline/mail/image/*http://es.mail.yahoo.com"><img src="http://eur.i1.yimg.com/eur.yimg.com/i/es/mail/mails.gif" width=230 height=80 alt="Nuevo Correo Yahoo!"></a></blockquote><br>
<br>
<br>
<a href="http://es.rd.yahoo.com/mail_es/tagline/mail/image/*http://es.mail.yahoo.com"><img src="http://eur.i1.yimg.com/eur.yimg.com/i/es/mail/mails.gif" width=230 height=80 alt="Nuevo Correo Yahoo!"></a></blockquote></body>
</html>