日期:2014-05-18  浏览次数:20713 次

请教高手,在TOMCAT下运行SERVLET需要怎么配置?在线等。
我在TOMCAT的WEB下调用了一个JSP页面,然后把SERVLET放到\webapps\web\WEB-INF\classes里面,在SERVER.XML中也把context项改为如下(我的包名是untitled2)  

<Context   path= "/untitled2 "  

docBase= "webapps/untitled2 "  

crossContext= "false "  

debug= "0 "  

reloadable= "true "   >  

</Context>  

<Context   path= "/web "  

docBase= "webapps/web "  

crossContext= "false "  

debug= "0 "  

reloadable= "true "   >  

</Context>  

但现在总是报错  

Error:   500  

Location:   /web/servlet/UploadFileServlet  

Internal   Servlet   Error:  

java.lang.NullPointerException  

at   java.lang.ClassLoader.resolveClass0(Native   Method)  

at   java.lang.ClassLoader.resolveClass(ClassLoader.java:641)  

at   org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java:430)  

at   org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)  

at   org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)  

at   org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)  

at   org.apache.tomcat.core.Handler.service(Handler.java:254)  

at   org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)  

at   org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)  

at   org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)  

at   org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)  

at   org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)  

at   org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)  


------解决方案--------------------
要寻求帮助,代码贴出来是阐述问题的最好的方法之一,lz你将servlet代码贴出来看看, 然后想怎么调用?
------解决方案--------------------
WEB-INF目录下的web.xml配置路径配了么?