Weblogic 10.3.1.0正在使用com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar ...我想从我的代码中使用commons-net-2.0.jar [英] Weblogic 10.3.1.0 is using com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar... I want to use commons-net-2.0.jar from my code
问题描述
Weblogic 10.3.1.0正在使用com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar ...我想从我的代码中使用commons-net-2.0.jar。
Weblogic 10.3.1.0 is using com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar... I want to use commons-net-2.0.jar from my code.
如何强制它仅在我的代码中使用较新的JAR?
How can I force it to use the newer JAR in my code only?
推荐答案
我想从我的代码中使用commons-net-2.0.jar。
I want to use commons-net-2.0.jar from my code.
WebLogic使用父类加载器优先策略,您基本上有两个选项来调整此行为:
WebLogic uses a parent class loader first strategy and you basically have two options to tweak this behavior:
- 使用 prefer-web-inf-classes 元素在
weblogic.xml
Web应用程序部署描述符中(进入web.xml
旁边的WEB-INF~或〜 - 将您的war内部包装到EAR并使用WebLogic 筛选类加载器您在配置
weblogic-application.xml
描述符(位于application.xml
旁边的META-INF中)
- Use the prefer-web-inf-classes element in a
weblogic.xml
Web application deployment descriptor (that goes in WEB-INF next to theweb.xml
) ~or~ - Package your war insider an EAR and use WebLogic Filtering classloader that you configure in a
weblogic-application.xml
descriptor (that goes in META-INF next to theapplication.xml
)
以下是weblogic.xml的示例:
Here is an example weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
以下是weblogic-application.xml的示例:
Here is an example weblogic-application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
</prefer-application-packages>
</weblogic-application>
前一个选项更简单,但对于webapp是全局的。如果您目前没有使用EAR包装但是提供更好的控制,后者会引入更多复杂性。
The former option is simpler but is global to the webapp. The later introduces more complexity if you're not currently using an EAR packaging but gives finer control.
- Understanding WebLogic Server Application Classloading
这篇关于Weblogic 10.3.1.0正在使用com.bea.core.apache.commons.net_1.0.0.0_1-4-1.jar ...我想从我的代码中使用commons-net-2.0.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!