Hi all, I am using Tomcat in Windows to get some Servlet/JSP experience. I can run all the sample servlet/jsp files but I cannot run my own web application. I create a directory structure for my web-app like I am supposed to: C:\Tomcat\webapps\HelloWorld C:\Tomcat\webapps\HelloWorld\web-inf C:\Tomcat\webapps\HelloWorld\web-inf\classes C:\Tomcat\webapps\HelloWorld\web-inf\lib The servlet in the classes folder. All the enviroment variables etc is set up properly. I add a context to the server.xml file, and create a web.xml with servlet name and servlet class in the web-inf. But it doesn't run and I get the following error below. NOTE: If I run my servlet in the \test webapp folder, adding it to the web.xml file it runs fine. I just can't run it creating my own directories. Any help would be greatly appreciated. It's Tomcat 3.2.1 by the way which should be stable right? --Alexis Error: 500 Location: /HelloWorld Internal Servlet Error: java.lang.NullPointerException at org.apache.tomcat.util.FileUtil.isAbsolute(FileUtil.java:289) at org.apache.tomcat.core.Context.getAbsolutePath(Context.java:257) at org.apache.tomcat.core.Context.getRealPath(Context.java:791) at org.apache.tomcat.request.StaticInterceptor.requestMap(StaticInterceptor.java:191) at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:820) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:771) 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) at java.lang.Thread.run(Thread.java:484)
I add a context to the server.xml file, and create a web.xml with servlet name and servlet class in the web-inf. You need to do either of these two things, not both, I guess. Personally I would get rid of the web.xml file and try. regds. - satya
The server.xml file is required to give you contexts.
The web.xml is required so that Tomcat can understand how to user your web app.
You need both.
Can you post the relative portion of your server.xml and your web.xml? The error 500 makes me wonder though... it almost seems like a problem with the servlet you've written, although you say you can get it to run in a different directory.
Joined: Jun 03, 2000
The web.xml is required so that Tomcat can understand how to user your web app. You need both. yikes.... I neither agree nor disagree.... While the web.xml is required for setting some application specific stuff, I personally would neglect it in the beginning. Once I am comfortable with running and deploying simple applications in Tomcat, then is the time to dig deeper into these. My two cents worth. regds. - satya
Joined: Jun 27, 2001
I figured it out and I feel really stupid. The problem was the first line with the web.xml file I had this: <? xml version="1.0"?> When I changed it to this, everything is fine: <?xml version="1.0"?> I am new to XML and didn't know that one space would screw things up that much. Plus, nothing in the console output or error log file pointed that out to me. Thanks for your help everyone.
Joined: Jun 03, 2000
..and I feel really stupid and thats the bonus everyone gets with using Tomcat...
Sorry, couldn't resist the dig. - satya
[This message has been edited by Madhav Lakkapragada (edited June 28, 2001).]