是否可以在不单独部署 J2EE 容器的情况下虚拟化 war 文件执行?

发布于 2024-08-27 11:35:55 字数 372 浏览 5 评论 0原文

假设我想允许我的开发人员将他们的 war 文件上传到我们的 Intranet 上运行的 Web 应用程序(不是应用程序服务器本身)以及该 Web 应用程序< /strong> 然后运行这些战争就好像它们是单独部署在我们的 J2EE 容器中的单独应用程序

换句话说,我们实际上并没有将 wars 作为容器中的单独应用程序进行部署 - 它们只是在这个 Web 应用程序内并排运行 其行为类似于 J2EE 容器

这可能吗?

类似于 war 虚拟化应用程序?

Let's say I want to allow my developers to upload their war files to a web app (not the application server itself) running on our intranet and that web app would then run those wars as if they were separate apps deployed individually in our J2EE container.

In other words, we are not actually deploying the wars as separate apps in the container - they are simply running side-by-side inside this one web app that acts like a J2EE container.

Is that possible?

Something like a war virtualization app?

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

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

发布评论

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

评论(2

小草泠泠 2024-09-03 11:35:55

您可以开始创建 ClassLoader、扩展 .war、加载类并将对应用程序的请求分派到正确的子 Web 应用程序。这看起来像是重新发明轮子(假设 app.server 已经这样做了)并且可能非常复杂。

另一方面,这看起来与 portlet 的工作方式非常相似。 Portlet 被打包到 .war 文件中,然后由门户使用。例如,在 Liferay 门户中,您可以从 liferay 门户(而不是 app.server 本身)上传 portlet .war。然后,Liferay 会将上传的 .war 文件放置在应用程序的自动部署目录中。然后将像常规 Web 应用程序一样部署。然后是 portlet 桥,它将请求从门户分派到正确的 portlet Web 应用程序等。也许值得仔细研究一下。

我不知道你的要求,但我绝对会尝试保持简单,因为这样的事情可能会变得非常复杂。但您可以:

  • 让用户从您的应用程序上传 .war
  • 操作 .warweb.xml 以确保上下文类似于/ParentApp/ChildApp
  • 将修改后的.war保存到auto-deploy文件夹中并让应用程序。服务器部署它

这将提供您可以从父 Web 应用程序部署子 Web 应用程序的错觉。

You could start creating ClassLoader, expanding the .war, loading the classes and dispatching the request to your application to the right sub web app. That looks like re-inventing the wheel (given that the app. server does that already) and is probably very complicated.

On the other side, this looks terribly similar to how portlets work. Portlets are packaged into a .war file and are then used by the portal. For instance, in Liferay portal, you can upload a portlet .war from the liferay portal (not the app. server itself). Liferay will then place the uploaded .war file in the auto-deploy directory of the app. server which will then be deployed like a regular web app. Then there is the portlet bridge that dispatch the request from the portal to the right portlet web app, etc. It's maybe worth having a closer look at that.

I don't know your requirements, but I would definitively try do keep it simple as such stuff can get really complicated. But you could:

  • Let user upload the .war from you application
  • Manipulate the .war and web.xml to ensure that the context is something like /ParentApp/ChildApp
  • Save the modified .war to the auto-deploy folder and let the app. server deploy it

This will provide the illusion the you can deploy sub webapp from your parent webapp.

你如我软肋 2024-09-03 11:35:55

有什么具体原因需要他们参与另一场战争吗?听起来你需要做的是实现你的目标 - 如果你在你的战争中运行它可能是不可能的 - 是构建一个战争,然后使用他们上传的战争并使用 API 来部署网络服务器的战争公开部署战争,从而让它作为顶级 Web 应用程序运行。我认为没有其他方法可以做到这一点。

Is there any specific reason why you need them to run side the context of another war? Sounds like what you need to do to achieve your goal - it's probably impossible to do if you're running it inside your war - is to build a war which then takes that war they upload and uses the API for deploying wars that the web server exposes to deploy the war and thus let it run as a top level web app. I don't think there's any other way to do it.

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