m2e webapp“在服务器上运行”在 Eclipse 中不工作

发布于 2024-12-23 18:23:55 字数 574 浏览 2 评论 0原文

我使用 Jersey 和 Eclipse 的动态 Web 项目创建了一个 Web 应用程序。当我执行“在服务器上运行”时,效果很好。

我想使用 m2e 将我的项目移植到 Maven 中。我可以使用 m2e 和“运行方式 -->”成功构建 WAR 文件Maven 安装'.然而,当我执行“运行为 -->”时在服务器上运行'根类不会被扫描,结果我收到'403 Forbidden'错误(创建了正确的tomcat用户'manager',所以我认为这不是tomcat访问问题)。

Eclipse 控制台显示没有尝试扫描根或提供程序类(当我在没有 Maven 的情况下将其作为普通动态 Web 项目运行时,它会正确扫描根类)。不知何故,泽西岛应用程序初始化没有发生。它只是没有调用“com.sun.jersey.api.core.PackagesResourceConfig init”。

当我将 m2e 生成的 WAR 部署到独立的 tomcat 时,它工作正常。我想使用 eclipse tomcat 插件从 Eclipse 调试 Web 应用程序(就像在没有 m2e 的普通动态 Web 项目中发生的方式一样)。

以前有人遇到过类似的问题吗?是否缺少任何配置?

I have created a web application using Jersey and Dynamic Web Project of Eclipse. It worked fine when I do 'Run On Server'.

I wanted to port my project into maven using m2e. I could successfully build WAR file using m2e and 'Run As --> Maven install'. However, when I do 'Run As --> Run on Server' the root classes are not scanned and I get '403 Forbidden' error as a result (proper tomcat user 'manager' is created so I think it is not tomcat access issue).

Eclipse console shows that there are no attempts made to scan the root or provider classes (when I run it as plain Dynamic Web Project without maven, it scanned root classes properly). Somehow Jersey application initialization is not happening. It is just not calling 'com.sun.jersey.api.core.PackagesResourceConfig init'.

When I deploy the m2e generated WAR to standalone tomcat it works fine. I want to debug the web app from Eclipse using eclipse tomcat plugin (just the way it happen in plain Dynamic Web Project without m2e).

Has anyone faced similar problem before? Is there any configuration missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2024-12-30 18:23:55

Maven Install 只是将您的应用程序安装到 Maven 存储库中,除非您使用其他 Maven 插件来部署 WAR 文件(复制命令以将 war 放入部署文件夹中)。也许可以尝试其他 Maven 选项,例如 Package,看看是否有效。还要检查 eclipse 中的项目目标文件夹,并手动将 WAR 文件复制到服务器,看看是 WAR 还是有问题的服务器。您首先应该做的主要事情是验证使用 maven 编译的 WAR 文件是否是该文件服务器正在尝试使用。

Maven Install just installs your app into your Maven repository unless you use other maven plugins to also deploy your WAR file (copy command to put war in deploy folder). Maybe try the other Maven options like Package and see if that works. Also check the projects target folder in eclipse and manually copy your WAR file to the server to see if its the WAR or the server with the problem.The main thing you should do first is verify that the WAR file you compile with maven is the file the server is trying to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文