This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one 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>
I tried that and still I get a HTTP 404 error The requested resource (/HelloServlet) is not available.
Im a bit stumped as it works fine in the examples directory. I must be doing something really stupid...
Author and all-around good cowpoke
Joined: Mar 22, 2000
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