且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Tomcat api中部署war文件后不起作用

更新时间:2023-11-17 23:09:04

当你从 Eclipse 启动应用程序时,它使用一个独立的服务器,通过 localhost 直接访问,URL 为 http://localhost:8080/api/originator.

When you start the application from Eclipse, it uses a standalone server, which is directly accessed via localhost and the URL is http://localhost:8080/api/originator.

当您运行本地 tomcat 实例时,http://localhost:8080 是基本的 tomcat URL.接下来是您的应用程序的名称,在本例中为 web_importer.所以 URL 变成了 http://localhost:8080/web_importer/api/originator 这是为什么你会得到 404 Not Found.

When you run your local tomcat instance, http://localhost:8080 is the base tomcat URL. What follows next is the name of your application, in this case web_importer. So the URL becomes http://localhost:8080/web_importer/api/originator and this is why you get 404 Not Found.

您的前端似乎是直接在 http://localhost:8080/api/originator.当您想要使用您的 API 的 tomcat 部署版本时,您需要在前端配置中更改您的基本 API URL.

It seems that your frontend is calling the API directly at http://localhost:8080/api/originator. You need to change your base API URL in your frontend configuration when you want to use the tomcat-deployed version of your API.