JBOSS ordering of contents of WEB-INF/lib

2020-07-23 06:20发布

I have an ear file, containing a war file. The war contains a number of jars in its WEB-INF/lib directory. Some of these jars contain confilicting (or at least different ) versions of the same classes. Is there a way that I can influence the order that JBOSS will add these jar files on to the classpath?

For example, if com.dave.A.class is found in a.jar and b.jar, both of which are in WEB-INF/lib, and I know that b.jar contains the "correct" version of the class, how do I ensure that JBOSS uses b.jar in preference to a.jar.

I'm aware that this makes my application extremely fragile, so please don't flame me for that :)

2条回答
2楼-- · 2020-07-23 06:35

This got answered in Order of class loading from a .war file

WEB-INF/classes is loaded before WEB-INF/lib

查看更多
唯我独甜
3楼-- · 2020-07-23 06:46

No, I don't believe you can dictate any control over this. If you're lucky, the classloader wil lload them in the "correct" order.

You really need to sort out the libraries so that there are no conflicts, by repacking them, if necessary.

查看更多
登录 后发表回答