JBOSS ordering of contents of WEB-INF/lib

女生的网名这么多〃 提交于 2019-12-06 06:45: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 :)


回答1:


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.




回答2:


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

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



来源:https://stackoverflow.com/questions/5727703/jboss-ordering-of-contents-of-web-inf-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!