Mapscript on java/J2EE/Tomcat error

Sujnana Rai sujnan at PIXELINFOTEK.COM
Fri Aug 3 23:06:26 PDT 2007


Hi,
   I am trying to develop sample web gis application using mapserver on 
java/j2ee/tomcat platform.
For this I followed following steps
1. Downloaded MapServer for Windows(ms4w_2.2.4) and installed it.
2. Added library paths('D:\ms4w\Apache\cgi-bin' and 'D:\ms4w\Apache\cgi-
bin\mapscript\java') to environment variable PATH
3. As I am using eclipse IDE so I included mapscript.jar to build path (located 
at D:\ms4w\Apache\cgi-bin\mapscript\java) to build path and added 
Djava.library.path="D:\ms4w\Apache\cgi-bin;D:\ms4w\Apache\cgi-
bin\mapscript\java" to VM arguments.


Now I created jsp page called mapdemo.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="edu.umn.gis.mapscript.*"%>
<% 
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()
+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'mapdemo.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" 
content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <%
  
  
  	mapObj map = new mapObj
("D:\\ms4w\\apps\\tutorial\\htdocs\\example_modes.map");
   	
   	
   
   
   
   %>
    This is my JSP page. <br>
  </body>
</html>


While run time it thows following error 


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException
(JspServletWrapper.java:504)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:375)
	org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

javax.servlet.ServletException: Could not initialize class 
edu.umn.gis.mapscript.mapscriptJNI
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:858)
	org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:791)
	org.apache.jsp.mapdemo_jsp._jspService
(org.apache.jsp.mapdemo_jsp:93)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:332)
	org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.lang.NoClassDefFoundError: Could not initialize class 
edu.umn.gis.mapscript.mapscriptJNI
	edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:284)
	org.apache.jsp.mapdemo_jsp._jspService
(org.apache.jsp.mapdemo_jsp:77)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:332)
	org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Please help me to come out of this exception
Thanks in advance
Sujnan



More information about the MapServer-users mailing list