eclipse 下的servlet 的小例子问题?
SERVLET 能编译,但一运行就报错:
java.lang.ExceptionInInitializerError
com.mapinfo.xmlprot.XMLUtils.
com.mapinfo.xmlprot.mxtj.cf.
com.mapinfo.mapj.MapJ.a(Unknown Source)
com.mapinfo.mapj.MapJ.loadMapDefinition(Unknown Source)
com.mapinfo.mapj.MapJ.loadMapDefinition(Unknown Source)
com.newcom.its.servlet.Test.doGet(Test.java:76)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
是不是需要对运行环境做什么别的配置,相同的目录下,普通的SEVLET 就能运行正常,为什么只要引用了MAPXTREME JAVA 的*.JAR 能编译,而一运行就报错呢?
web.xml 配置如下:
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd";;>
import java.io.*;
import javax.servlet.http.*;
import java.awt.Color;
import javax.servlet.*;
import com.mapinfo.dp.*;
import com.mapinfo.dp.util.*;
import com.mapinfo.graphics.*;
import com.mapinfo.mapj.FeatureLayer;
import com.mapinfo.mapj.Layers;
import com.mapinfo.mapj.MapJ;
import com.mapinfo.mapxtreme.client.MapXtremeDataProviderRef;
import com.mapinfo.mapxtreme.client.MapXtremeImageRenderer;
import com.mapinfo.mapdefcontainer.MapDefContainer;
import com.mapinfo.util.*;
import com.mapinfo.xmlprot.mxtj.ImageRequestComposer;
public class test extends HttpServlet
{
private static String mimeType = "image/gif";
private static String m_mapPath = "D:\\Program Files\\MapInfo\\MapXtreme-4.7.0\\examples\\server\\data\\dengjn\\world.mdf";
private static String m_mxtURL = "http://dengjn:8080/mapxtreme47/servlet/mapxtreme";;;
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType(mimeType);
ServletOutputStream sos = response.getOutputStream();
MapJ m_mapj = new MapJ();
m_mapj.loadMapDefinition(m_mapPath);
m_mapj.setDeviceBounds(new DoubleRect(0,0,800,600));
try
{
ImageRequestComposer irc =ImageRequestComposer.create
(m_mapj,256,Color.white,mimeType);
MapXtremeImageRenderer renderer = new MapXtremeImageRenderer(m_mxtURL);
renderer.render(irc);
renderer.toStream(sos);
renderer.dispose();
}
catch (Exception e)
{
System.out.println("Error");
e.printStackTrace();
}
}
}