2013/5/12 Zheng Yang <zhengyan...@gmail.com>: > Hi list, > > I learned that @WebServlet("") is for mapping the application context root. > e.g. http://localhost:8080/myapp/ > Unfortunately doesn't work after a context reload. > This problem can be easily reproduced: > > 1.Create a HelloWorld application with a single servlet, say the servlet is > called RootServlet.java > 2.Map RootServlet to context root using @WebServlet("") annotation > 3.If you deploy it on a local tomcat server, it will work. > http://localhost:8080/HelloWorld/ will give whatever you print in > RootServlet > 4.But if you reload the app (say using the manager app), > http://localhost:8080/HelloWorld/ will give 404 error. RootServlet is never > called this time. > > Environment: Windows 8, Java 7, Tomcat 7.0.40 > > Is this the intended behavior or a bug actually? >
If it happens as you describe it, then it should be a bug. Please file an issue in Bugzilla. http://tomcat.apache.org/bugreport.html#How_to_write_a_bug_report Can you attach to your report a simple web application, with source code, that reproduces the issue? Two questions: a) Is it specific to the context root (empty string) mapping? b) Is it specific to annotations? (Does it work if you specify the mapping in web.xml)? BTW, support for such mappings was added to Tomcat 7 rather late (in 7.0.28 - bug 53356 ). Apparently they are no so widely used. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org