Websphere共享库"优先级"?

Adr*_*hum 5 websphere

在Websphere中,可以创建"共享库"并与应用程序关联.我想知道,就类路径中的位置而言,共享库的位置是什么?这意味着,我想知道,如果资源重复,将加载更高的"优先级",共享库或EAR/WAR本身.

例如,假设在我的应用程序中,我有一个名为appConfig.xml的资源,我在app服务器中创建一个本地目录,在该目录中放置另一个appConfig.xml.如果我尝试在我的应用程序中加载资源(例如打开输入流),将加载哪个文件?

我已经搜索了一段时间,却发现无处可提.虽然我可以通过实验亲自尝试,但我想知道官方预期的行为,如果有的话.

非常感谢

Bre*_*ail 5

类加载器之间的排序使用所谓的“类加载器模式”,该模式可以是“父级优先”(和应用程序类/资源最后)或“父级末尾”(应用程序类/资源优先)。对于单个应用程序类加载器,类路径顺序将为:

  1. module class paths
  2. dependency class paths (Class-Path in MANIFEST.MF)
  3. shared library class paths

There is no configuration option to change the ordering. I do not think this ordering is explicitly state in documentation, but I also think it's highly unlikely to change. Regardless, I would not recommend relying on it. I would recommend ensuring you use unique resource/class names within a single class loader.

  • 同样,如果您有疑问并想知道WAS如何使用这些库,则可以使用WAS管理控制台上的“ WebSphere Web控制台->故障排除->类加载器查看器”视图。 (3认同)
  • 是的,类加载器查看器对于确定服务器如何组装事物非常有用。它不一定解释订购的理由。 (2认同)