<DIV><BR>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>I am using mapserver 4.2.4.</DIV>
<DIV>All I wanted to do is to do any simple mapserver instructions to see that everything works.</DIV>
<DIV>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.</DIV>
<DIV>For example it will be great if i could manage to just draw a .map file for instance as a response to the client.</DIV>
<DIV>Does anyone know how to do this, or what easy instructions I can use to see if it works?</DIV>
<DIV> </DIV>
<DIV>Thank you</DIV>
<DIV> </DIV>
<DIV>Jose Luis<BR><BR><B><I><sgillies@FRII.COM></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Nov 29, 2004, at 4:26 AM, Jose Luis Gonzalez wrote:<BR><BR>> --0-82611386-1101727598=:30831<BR>> Content-Type: text/plain; charset=iso-8859-1<BR>> Content-Transfer-Encoding: 8bit<BR>><BR>> This is my code:<BR>> First of all I have this file:<BR>><BR>> package javamaps;<BR>><BR>> public class MapserverLibLoad{<BR>> public static void loadLibrary() throws UnsatisfiedLinkError{<BR>> System.loadLibrary("mapscript");<BR>> }<BR>> }<BR>><BR>> Then this is the principal program, as you see it is a servlet:<BR>><BR>> import javamaps.*;<BR>> import edu.umn.gis.mapscript.*;<BR>> import javax.ejb.*;<BR>> import javax.xml.parsers.*;<BR>> import javax.xml.transform.*;<BR>> import javax.xml.transform.dom.*;<BR>> import org.w3c.dom.*;<BR>> import java.sql.*;<BR>> import javax.sql.*;<BR>> import
javax.naming.*;<BR>><BR>> import javax.servlet.*;<BR>> import javax.servlet.http.*;<BR>> import java.io.*;<BR>> public class test2 extends HttpServlet{<BR>><BR>> InitialContext initialContext=null;<BR>><BR>> static{<BR>> try{<BR>> MapserverLibLoad.loadLibrary();<BR>> }catch(UnsatisfiedLinkError e){<BR>> e.printStackTrace();<BR>> System.out.println("CONTINUE");<BR>> }<BR>> }<BR>><BR>><BR>> /<BR>> /----------------------------------------------------------------------<BR>> ------------------------------------------------------<BR>><BR>> private Connection createDatabaseConnection()throws EJBException{<BR>> DataSource dataSource;<BR>> Connection connection;<BR>> PreparedStatement stmt;<BR>> try{<BR>> dataSource = (DataSource) initialContext.lookup("jdbc/lbs");<BR>> connection= dataSource.getConnection();<BR>> //System.out.println("<BR>>
DATABSE:::::"+connection.getMetaData().getUserName());<BR>> return connection;<BR>> }catch (SQLException e){<BR>> throw (new EJBException(e));<BR>> }catch (NamingException e){<BR>> throw (new EJBException(e));<BR>> }<BR>> }<BR>><BR>><BR>><BR>> /<BR>> /----------------------------------------------------------------------<BR>> ------------------------------------------------------<BR>> public void init (ServletConfig cfg){<BR>> try{<BR>> System.out.println("Try to init servlet");<BR>> System.out.flush();<BR>> initialContext= new InitialContext();<BR>> }catch(Exception e){<BR>> throw (new EJBException(e));<BR>> }<BR>><BR>> }//fin init<BR>><BR>> public void service (HttpServletRequest req, HttpServletResponse res){<BR>> Connection conexion=null;<BR>> String imei=null;<BR>> PrintWriter out=null;<BR>> Statement orden=null;<BR>> ResultSet rs=null;<BR>> String SQL=null;<BR>><BR>> try{ itemObj
item = new itemObj();<BR>> System.out.println(" BIG NAME<BR>> :>>"+item.getName()+"<<");<BR>><BR>> conexion=this.createDatabaseConnection();<BR>> imei=req.getParameter("IMEI");<BR>> out=res.getWriter();<BR>> SQL="SELECT * FROM Client WHERE Name=";<BR>> SQL=SQL+"'"+imei+"'";<BR>> orden=conexion.createStatement();<BR>> rs=orden.executeQuery(SQL);<BR>> res.setContentType("text/html");<BR>> out.println("");<BR>> out.println("
<TABLE border=1>");<BR>> rs.next();//I move to the first row<BR>> out.println("
<TBODY>
<TR>
<TD colSpan=3>");<BR>> out.println("</TD></TR>");<BR>> out.println("
<TR>
<TD>"+rs.getString("Name"));<BR>> out.println("</TD>
<TD>"+rs.getString("Mobile"));<BR>><BR>> out.println("</TD>
<TD>"+rs.getString("Telephone_Number"));<BR>> out.println("</TD></TR>");<BR>> while (rs.next()){<BR>> out.println("
<TR>
<TD>"+rs.getString("Name"));<BR>> out.println("</TD>
<TD>"+rs.getString("Mobile"));<BR>><BR>> out.println("</TD>
<TD>"+rs.getString("Telephone_Number"));<BR>> out.println("</TD></TR>");<BR>> }<BR>> out.println("</TBODY></TABLE>");<BR>><BR>><BR>><BR>> }//fin try<BR>> catch (Exception e){<BR>> System.out.println(e);<BR>> }catch (Throwable e){<BR>> System.out.println("WRONGG POINT");<BR>> e.printStackTrace();<BR>> }finally{<BR>> try{<BR>> out.close();<BR>> rs.close();<BR>> conexion.close();<BR>> orden.close();<BR>> }catch(Exception e){<BR>> throw (new EJBException(e));<BR>> }<BR>><BR>> }//fin service<BR>><BR>> }<BR>> }<BR>><BR>> It seems as like he can't reach the mapserver librarys and I don't<BR>> know why.It gives me this error:<BR>><BR>> java.lang.UnsatisfiedLinkError: new_itemObj<BR>><BR>> Can someone help me?<BR>> Know what I'm doing wrong?<BR>><BR>> Thank you<BR>><BR>> Jose Luis<BR>><BR><BR>Jose Luis,<BR><BR>1) it is *very* important that you mention which version of
MapServer<BR>you use! The mapscript module has changed very much from 3.6 to 4.4.<BR><BR>2) do not try to use itemObj, it is not functional. We use SWIG to<BR>generate the mapscript wrapper for Java, and it is very permissive,<BR>with the result that non-functional classes can be accidently<BR>added to mapscript. I'm going to shut itemObj out of the final 4.4<BR>release.<BR><BR>cheers,<BR>Sean<BR><BR><BR><BR>--<BR>Sean Gillies<BR>sgillies at frii dot com<BR>http://users.frii.com/sgillies<BR></BLOCKQUOTE>
<P>
<HR SIZE=1>
<BR>
<TABLE>
<TBODY>
<TR>
<TD><A href="http://es.rd.yahoo.com/mail_es/tagline/mail/image/*http://es.mail.yahoo.com"><IMG height=80 alt="Nuevo Correo Yahoo!" src="http://eur.i1.yimg.com/eur.yimg.com/i/es/mail/mails.gif" width=230 align=left border=0></A></TD></TR></TBODY></TABLE></BLOCKQUOTE></DIV><p>
<hr size=1><br><table><tr><td><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" height=80 width=230 alt="Nuevo Correo Yahoo!" border=0 align="left"></a></td></tr></table>