Is there any way to set up servlet mapping in Tomcat when you dont have access to the server.xml file. Im running on a shared instance of tomcat & we only have access to the web.xml. We have set that up right but the servlets are still not found, then I read somewhere that BOTH the server.xml & the web.xml need to show the mapping. Any help at all would be much appreciated as this is just as frustrating as it can be.
Yeah quite right, mapping is only added to web.xml of ur application which is present in the web-inf folder. May be if u r using tomcat try creating a new application because sometimes it has problems.
U can try adding a new application , which does not requires any entry in the server.xml, jst make the entry in the web.xml under <servlet> and <servlet-mapping> and restart the server.If this does not solve the purpose try using another instance of Tomcat
I have tried myself to map a URI to a servlet, but am having partial success. On my machine, it works, but when I upload the application, the URI is not directed to the servlet. My web.xml servlet mapping looks like this: <servlet> <servlet-name> Controller </servlet-name> <servlet-class> util.Controller </servlet-class> </servlet> <servlet-mapping> <servlet-name> Controller </servlet-name> <url-pattern> /welcome </url-pattern> </servlet-mapping> If I go to http://localhost/<appname>/welcome, this works... The Controller servlet is found. When I upload the application and try http://<hostname>/welcome, it fails miserably with a 404 NOT FOUND message. The mapping is simply not working on the internet, but is, on my PC. I cannot see my mistake. My Controller serlet is in WEB-INF/classes/util folder. The web.xml is in WEB-INF. I've even had the administrators of the server give me the context info from server.xml. But this hasn't shown me what the problem is either. <Host name="www.<hostname>" > <Alias name="<hostname>" /> <Context path="" docBase="/home/virtual/site22/fst/var/www/html" reloadable="true" /> <AutoWebApp dir="/home/virtual/site22/fst/var/www/html" host="www.<hostname>" reloadable="true" /> <AutoDeploy source="/home/virtual/site22/fst/var/www/html" target="/home/virtual/site22/fst/var/www/html" redeploy="true" /> </Host> I'm thinking of scrapping the servlet mapping and pointing directly to the servlet in lite of the situation. I hope someone out there has an answer as to why it works off line, but not online.
-Mike Destefano<br />"Sometimes you feel like a nut..."