[英]JBOSS ordering of contents of WEB-INF/lib
I have an ear file, containing a war file. 我有一个包含war文件的ear文件。 The war contains a number of jars in its WEB-INF/lib directory.
战争在其WEB-INF / lib目录中包含许多jar。 Some of these jars contain confilicting (or at least different ) versions of the same classes.
这些罐子中的一些包含相同类别的confilicting(或至少不同)版本。 Is there a way that I can influence the order that JBOSS will add these jar files on to the classpath?
有没有办法可以影响JBOSS将这些jar文件添加到类路径的顺序?
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. 例如,如果在a.jar和b.jar中找到com.dave.A.class,它们都在WEB-INF / lib中,并且我知道b.jar包含该类的“正确”版本,我如何确保JBOSS优先使用b.jar而不是a.jar。
I'm aware that this makes my application extremely fragile, so please don't flame me for that :) 我知道这使我的应用程序非常脆弱,所以请不要因此而激怒我:)
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. 你真的需要整理这些库,以便在必要时通过重新打包来解决冲突。
This got answered in Order of class loading from a .war file 这得到了.war文件中的类加载顺序
WEB-INF/classes is loaded before WEB-INF/lib 在WEB-INF / lib之前加载WEB-INF / classes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.