将项目添加到 WebLogic 10 中的应用程序 (WAR) 类路径?

发布于 2024-08-08 13:44:49 字数 373 浏览 4 评论 0原文

我的商店运行 Oracle 应用服务器已有好几年了。因此,在我们了解得更清楚之前,我们已经制定了一种规范,将应用程序配置文件存储在 WAR 文件之外,并使用特定于 Oracle 的部署描述符将特定于应用程序的配置目录添加到每个应用程序中。此部署描述符允许我们在应用程序层添加类路径元素,而不必在 WAR 中包含所有依赖项。

现在我们面临着升级到 WebLogic 10.3,我需要为依赖外部配置的应用程序找到替代方案。

WebLogic 中有没有办法在应用程序级别将外部 jar 或目录添加到类加载器?我已经找到了将它们添加到系统类加载器的方法,但我更愿意将它们添加到应用程序级别,以避免除了修改部署描述符之外还要重新工作应用程序。

在 WebLogic 10 中这样的事情可能吗?

My shop has been running Oracle's Application Server for several years. As such, before we knew better, we have developed a norm of having application config files stored outside of the WAR file and the app-specific config directory is added to each application using an Oracle-specific deployment descriptor. This deployment descriptor allows us to add classpath elements at the application layer rather than having to include all dependencies in the WAR.

Now we are faced with upgrading to WebLogic 10.3 and I need to find an alternative for our applications that depend on external configs.

Is there a way in WebLogic to add external jars or directories to the classloader at the application level? I've found ways to add them to the system classloader, but I'd prefer to add them to the application level to avoid having to re-work the applications beyond modifying deployment descriptors.

Is such a thing possible in WebLogic 10?

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

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

发布评论

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

评论(3

皓月长歌 2024-08-15 13:44:49

经过进一步研究,我们了解了 WebLogic 的 Generic文件加载覆盖功能。

此功能允许我们为应用程序使用部署计划并为应用程序指定“配置根”。在 config-root 中,我们可以创建一个名为“AppFileOverrides”的目录,并覆盖 WEB-INF/classes 或 WEB-INF/lib 目录中的任何文件。

此功能的工作原理是在 Web 应用程序类加载器前面注入一个类加载器,因此从类路径加载的任何资源都将在捆绑到 Web 应用程序存档中的任何内容之前在此类加载器中找到。

使用此功能,我们可以添加 war 文件中根本不存在的配置文件(理论上是类)。因此,我们能够模仿将配置文件保留在战争之外的功能。

展望未来,我鼓励我们的开发人员将配置包含在 war 文件中,但这对于遗留应用程序以及我们需要更改给定部署目标(开发与生产)的配置的情况非常有效

After further research, we've learned about WebLogic's Generic File Loading Overrides feature.

This feature allows us to use a Deployment Plan for our application and specify a "config-root" for the application. Within the config-root, we can create a directory called "AppFileOverrides" and override any file in the WEB-INF/classes or WEB-INF/lib directories.

This feature works by injecting a classloader just in front of the Web Application classloader, thus any resource loaded from the classpath will be found in this classloader before anything bundled into the web application archive.

Using this feature, we are able to add configuration files (and in theory, classes) that don't exist in the war file at all. Thus, we are able to mimic the functionality of keeping configuration files outside the war.

Moving forward, I'm encouraging our developers to include the configurations inside the war file, but this will work nicely for legacy apps and for situations where we need to change the configuration for a given deployment target (dev vs production)

月依秋水 2024-08-15 13:44:49

使用共享库的部署可以引用外部 jar。

粗略地说,外部 jar 应该作为库“部署”。然后可以使用库引用描述符从应用程序的 weblogic-application.xml 引用它们。

请参阅此文档

不过,我认为除了使用系统类路径之外,您无法提供外部目录/配置文件。

External jars can be referenced by deployments using the shared libraries.

Roughly, the external jars should be 'deployed' as libraries. Then they can be referenced from your app's weblogic-application.xml using library-ref descriptors.

refer to this doc.

Though, I dont think you can provide external directories/config files other than by using system classpath.

茶色山野 2024-08-15 13:44:49

据我所知,这对于 Weblogic 来说是不可能的。外部配置文件确实需要添加到 系统类路径。您可以稍微调整类加载器(请参阅过滤加载顺序)但是没有任何东西允许像OAS那样在“应用程序级别”添加依赖项。为此,如果无法选择上述情况,则必须运行单独的域。

To my knowledge, this is not possible with Weblogic. External configuration files need indeed to be added to the system classpath. You can tweak a bit the classloader (see filtering and loading order) but there is nothing allowing to add dependencies at the "application level" a la OAS. For this, you'll have to run separated domains if the scenario mentioned above is not an option.

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