This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I have created a simple servlet and was able to deploy it to the Tomcat examples folder. Modified web.xml to contain the servlet and servlet-mapping tags for my HelloWorld servlet. I wanted to deploy it into another directoy so at the same level as examples forlder in Tomcat I created a folder called test and placed a web.xml plus the classes into that folder. The directory structure for my demo folder is
demo ---WEB-INF ----classes web.xml
in my web.xml I have <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>HelloServlet</servlet-class> </servlet>
Im a bit stumped as it works fine in the examples directory.
Probably the web.xml for your example folder has the "invoker" servlet turned on. The invoker is able to look for servlet classes that are not in a formal package (the "default" package).
However, the normal JVM class loader can NOT cope with this. ALL classes used in servlets should be put in a package. Trust me - this forum is littered with threads where people found this out the hard way.
Your web.xml would then give a complete package for servlet-class and the compiled class would be located accordingly under WEB-INF/classes