simple mapserver instrucctions don't work!!

Jose Luis Gonzalez joseluismapserver at YAHOO.ES
Mon Nov 29 06:26:38 EST 2004


This is my code:
First of all I have this file:

package javamaps;

public class MapserverLibLoad{
  public static void loadLibrary() throws UnsatisfiedLinkError{
    System.loadLibrary("mapscript");
  }
}

Then this is the principal program, as you see it is a servlet:

import javamaps.*;
import edu.umn.gis.mapscript.*;
import javax.ejb.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import org.w3c.dom.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class test2 extends HttpServlet{

    InitialContext initialContext=null;

    static{
    try{
      MapserverLibLoad.loadLibrary();
    }catch(UnsatisfiedLinkError e){
      e.printStackTrace();
      System.out.println("CONTINUE");
    }
  }

   //----------------------------------------------------------------------------------------------------------------------------

  private Connection createDatabaseConnection()throws EJBException{
    DataSource dataSource;
    Connection connection;
    PreparedStatement stmt;
    try{
      dataSource = (DataSource) initialContext.lookup("jdbc/lbs");
      connection= dataSource.getConnection();
      //System.out.println(" DATABSE:::::"+connection.getMetaData().getUserName());
      return connection;
    }catch (SQLException e){
      throw (new EJBException(e));
    }catch (NamingException e){
      throw (new EJBException(e));
    }
  }



//----------------------------------------------------------------------------------------------------------------------------
 public void init (ServletConfig cfg){
            try{
                System.out.println("Try to init servlet");
                System.out.flush();
                initialContext= new InitialContext();
            }catch(Exception e){
                throw (new EJBException(e));
            }

 }//fin init

 public void service (HttpServletRequest req, HttpServletResponse res){
                Connection conexion=null;
  String imei=null;
  PrintWriter out=null;
  Statement orden=null;
  ResultSet rs=null;
  String SQL=null;

 try{    itemObj item = new itemObj();
                System.out.println(" BIG NAME :>>"+item.getName()+"<<");

                conexion=this.createDatabaseConnection();
  imei=req.getParameter("IMEI");
  out=res.getWriter();
  SQL="SELECT * FROM Client WHERE Name=";
  SQL=SQL+"'"+imei+"'";
  orden=conexion.createStatement();
  rs=orden.executeQuery(SQL);
  res.setContentType("text/html");
  out.println("</Body></HTML>");
  out.println("<TABLE border=1>");
  rs.next();//I move to the first row
  out.println("<TR><TD COLSPAN=3>");
  out.println("</TD></TR>");
  out.println("<TR><TD>"+rs.getString("Name"));
  out.println("</TD><TD>"+rs.getString("Mobile"));
                out.println("</TD><TD>"+rs.getString("Telephone_Number"));
  out.println("</TD></TR>");
  while (rs.next()){
   out.println("<TR><TD>"+rs.getString("Name"));
   out.println("</TD><TD>"+rs.getString("Mobile"));
                         out.println("</TD><TD>"+rs.getString("Telephone_Number"));
   out.println("</TD></TR>");
  }
  out.println("</TABLE>");



 }//fin try
 catch (Exception e){
            System.out.println(e);
        }catch (Throwable e){
            System.out.println("WRONGG   POINT");
            e.printStackTrace();
 }finally{
            try{
                out.close();
                rs.close();
                conexion.close();
                orden.close();
            }catch(Exception e){
                throw (new EJBException(e));
            }

        }//fin service

        }
}

It seems as like he can't reach the mapserver librarys and I don't know why.It gives me this error:

java.lang.UnsatisfiedLinkError: new_itemObj

Can someone help me?
Know what I'm doing wrong?

Thank you

Jose Luis


---------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20041129/33343db6/attachment.html


More information about the mapserver-users mailing list