I have made 1 simple servlet and I try to deploy it to tomcat directly, without making war file and as a new entry in webapp called chapter_01. I am sure that the directory I have made is right and also modified web.xml in my directoy to add a servlet entry and also add a context in server.xml for chapter_01 but still I am getting error trying to call my servlet in this URL http://localhost:2005/chapter_01/servlet/HelloWorldServlet
web.xml needs to be in a directory called WEB-INF under your apps webapps dir. The structure of your app should be as follows:
webapps/YOUR_APP_NAME/JSPS, HTML webapps/YOUR_APP_NAME/WEB-INF/web.xml webapps/YOUR_APP_NAME/WEB-INF/classes/YOUR_PACKAGE/YOUR_CLASSES
You'll also need to map your servlets (in web.xml) The invoker servlet is no longer active by default in Tomcat. You don't need '/servlet' in your URL once you map the servlet. You also don't need to (and shouldn't) create a context entry in server.xml anymore. Check with the Tomcat documention for proper deployment procedures in version 5 and up.
If you want an example of a proper web.xml with a servlet mapping and the correct directory structure for a webapp, go to http://simple.souther.us, download and run SimpleServlet.
Tomcat will unpack the war file for you. You can then examine both the directory structure and the web.xml file to see what's different in your app that's keeping it from working.
-Ben [ January 22, 2005: Message edited by: Ben Souther ]
My structure is the same, but I am using tomcat 4 (and I have to) so I need to know without using war how to deploy a servlet(plus to what I have done). Additionaly I put the SimpleServlet.war in both tomcat 4 and 5 and even though they unpacked, using the URL I got error to access them.
Joined: Dec 01, 2003
Now after using mapping I get error 500 and classNotFoundException
Originally posted by Sean Mohseni: My structure is the same, but I am using tomcat 4 (and I have to) so I need to know without using war how to deploy a servlet(plus to what I have done). Additionaly I put the SimpleServlet.war in both tomcat 4 and 5 and even though they unpacked, using the URL I got error to access them. Sean
Tomcat 4 handles war deployments.
What URL are you using? SimpleServlet (as the name implies) is about the simplest thing that can be deployed in a container. What error are you seeing?
Joined: Dec 01, 2003
When I redploy SimpleServlet it is working fine, but if I understand right, you mean for tomcat 4, the only way to deploy a servlet is to make a war file? If I am wrong, what is the procedure, additional to what I have done before?
The reason I suggested running simpleServlet was for you to get something deployed in your server that you could use as a reference. As long as your app has the same directory structure as than one, it will work.