[英]Eclipse/Tomcat7: application context root reloading returns 404
I have a servlet which is mapped to application context root using the ""
string: So when I hit the url http://127.0.0.1:8080/myapp/
, I can see "This is ROOT!" 我有一个servlet,它使用""
字符串映射到应用程序上下文根:因此,当我单击URL http://127.0.0.1:8080/myapp/
,我可以看到“这是根!”。 in the browser. 在浏览器中。 So far so good. 到现在为止还挺好。
But if I modify something, say changing the String This is ROOT!!
但是,如果我修改了某些内容,请说更改字符串, This is ROOT!!
to ROOT!!
ROOT!!
and save the file in eclipse. 并将文件保存在eclipse中。 Eclipse will take a couple of seconds to reload the context. Eclipse将花费几秒钟来重新加载上下文。 Now if i hit the same url, a 404 page is displayed while all other pages still work fine. 现在,如果我点击了相同的网址,则会显示一个404页面,而其他所有页面仍然可以正常工作。 Only the root mapping is broken. 只有根映射被破坏。 So I redeploy (eclipse's "run on server") the app and the root mapping is back again. 因此,我重新部署了(eclipse的“在服务器上运行”)应用程序,并且根映射再次返回。 Any ideas on how can I fix this? 关于如何解决此问题的任何想法?
@WebServlet("")
public class Root extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().println("This is ROOT!!");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
https://issues.apache.org/bugzilla/show_bug.cgi?id=54955 https://issues.apache.org/bugzilla/show_bug.cgi?id=54955
This is a bug of tomcat 7.0.40. 这是tomcat 7.0.40的错误。 when you deploy it. 部署它时。 Context root is accessible. 上下文根是可访问的。 But reload the app will cause context root to return 404. 但是重新加载应用程序将导致上下文根返回404。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.