项目重命名后,Webapp显示404页面

时间:2022-09-03 22:52:50

I have been working on this web application using Eclipse and m2e (maven plugin for Eclipse).

我一直在使用Eclipse和m2e(Eclipse的maven插件)处理这个Web应用程序。

After a while I decide to change the project name in eclipse doing: Right click on project >> refactor >> rename

过了一会儿我决定在eclipse中更改项目名称:右键单击项目>> refactor >> rename

Following this I see a few errors coming up, mostly to do with classpath configuration & java versions mismatch. I fix them, adding the maven dependencies to the build path, and updating the java versions to be used during compilation & run time.

接下来,我看到一些错误,主要与classpath配置和java版本不匹配有关。我修复它们,将maven依赖项添加到构建路径,并更新在编译和运行时使用的java版本。

I rebuild my web app & restart my server (Tomcat in this case). Open my browser to go to my app's root url. And I get a 404 page (everything looks fine in the console btw).

我重建我的网络应用程序并重新启动我的服务器(在这种情况下是Tomcat)。打开我的浏览器转到我的应用程序的根URL。我得到一个404页面(控制台btw中的一切看起来都很好)。

I've been going through my buildpath and classpath config to double check if anything was coming from there but everything seems fine. I'm confused and unsure where to look at.

我一直在通过我的buildpath和classpath配置来仔细检查是否有任何东西来自那里,但一切似乎都很好。我很困惑,也不确定在哪里看。

Thanks in advance

提前致谢

3 个解决方案

#1


0  

This really depends on your Setup. If you are using the default path, it is (as Kal said) myserver/newappname.

这实际上取决于您的安装程序。如果你使用的是默认路径,那就是(如Kal所说)myserver / newappname。

If you are using a url that you have configured in webserver for easier readability like (myapp.myserver.com) you would have to change the redirection in your server from your old appname to the new one.

如果您使用的是在网络服务器中配置的网址,以便于阅读(myapp.myserver.com),则必须将服务器中的重定向从旧的appname更改为新的appname。

#2


0  

Actually, 404 HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.

实际上,404 HTTP标准响应代码表明客户端能够与服务器通信,但服务器无法找到所请求的内容。

 1. Check your path with newapplication name.
 2. See inside your server, Is there a resource with (newNameApp.war)?
 3. As you are using maven, try to build the project and see the log, by which name war is generated, and where the war got placed.

#3


0  

I faced the same situation and simply restarted Eclipse and no more 404 afterward

我遇到了同样的情况,只是重新启动Eclipse,之后不再有404

#1


0  

This really depends on your Setup. If you are using the default path, it is (as Kal said) myserver/newappname.

这实际上取决于您的安装程序。如果你使用的是默认路径,那就是(如Kal所说)myserver / newappname。

If you are using a url that you have configured in webserver for easier readability like (myapp.myserver.com) you would have to change the redirection in your server from your old appname to the new one.

如果您使用的是在网络服务器中配置的网址,以便于阅读(myapp.myserver.com),则必须将服务器中的重定向从旧的appname更改为新的appname。

#2


0  

Actually, 404 HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.

实际上,404 HTTP标准响应代码表明客户端能够与服务器通信,但服务器无法找到所请求的内容。

 1. Check your path with newapplication name.
 2. See inside your server, Is there a resource with (newNameApp.war)?
 3. As you are using maven, try to build the project and see the log, by which name war is generated, and where the war got placed.

#3


0  

I faced the same situation and simply restarted Eclipse and no more 404 afterward

我遇到了同样的情况,只是重新启动Eclipse,之后不再有404