如何强制weblogic从web-inf / lib加载类

问题描述 投票:0回答:1

这个问题起源于问题here

基本上我想从我的war的web-inf \ lib加载slf4j jar而不是从weblogic的遗留罐中加载。

注 - 我正在部署WAR而不是EAR文件。在weblogic.xml中尝试了以下内容:

<wls:container-descriptor>
    <wls:prefer-application-resources>
        <wls:resource-name>org.slf4j.*</wls:resource-name>
        <wls:resource-name>ch.qos.*</wls:resource-name>
    </wls:prefer-application-resources>
</wls:container-descriptor>

但是weblogic仍在从其旧版jar中加载这些类,而不是从我的应用程序的web-inf \ lib加载

有人可以建议任何其他方法吗?

classloader weblogic12c
1个回答
0
投票

这些标签仅用于资源,您需要Filtering Classloader:

<wls:prefer-application-packages>
    <wls:package-name>org.slf4j</wls:package-name>
    <wls:package-name>ch.qos</wls:package-name>
</wls:prefer-application-packages>

另一种方法是使用:prefer-web-inf-classes(你不能同时使用)

更多信息:https://docs.oracle.com/cd/E24329_01/web.1211/e24368/classloading.htm#WLPRG315

© www.soinside.com 2019 - 2024. All rights reserved.