简体   繁体   English

JBOSS中的Maven项目,如何更改类加载器的优先级?

[英]Maven Project in JBOSS, how to change priority of classloader?

After reading this article: 阅读本文后:

EAR & WAR Class Loader EAR&WAR类装载机

and this artcle: 而这个文章:

CXF JBOSS issue CXF JBOSS问题

I am quite certain that JBOSS 4.2.3 class loader is trying to find class ServiceDelegate21 inside lib/endorsed folder but it's somehow different from class inside my EAR file and hence throws a : 我非常确定JBOSS 4.2.3类加载器正在尝试在lib / endorsed文件夹中找到ServiceDelegate21类,但是它与EAR文件中的类有所不同,因此抛出了:

java.lang.ClassCastException: org.apache.cxf.jaxws.ServiceImpl cannot
be cast to javax.xml.ws.spi.ServiceDelegate21

Of-course everything works fine if I move the 2 jars form endorsed folder. 当然,如果我将2个jars表单背书到文件夹中,则一切正常。 But this is not an option. 但这不是一个选择。

I need to tell JBOSS 4.2.3 GA Class loader from my maven project, to look first inside my EAR and then lib/endorsed folder. 我需要从我的maven项目中告诉JBOSS 4.2.3 GA Class loader,首先在EAR中查看,然后在lib / endorsed文件夹中查看。

Any ideas? 有任何想法吗?

[edit:] [编辑:]

Inside lib/endored: jboss-jaxws jboss-jaxws-ext 内部lib /认可:jboss-jaxws jboss-jaxws-ext

Inside my EAR, I believe the jar tha conflicts is 在我的EAR内部,我相信罐子里的冲突是

jaxws-rt-2.1.7.jar jaxws-rt-2.1.7.jar

but take a look at e full jar list of my project 但看看我的项目的完整jar列表

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

I see that you are mixing a lot of jars here. 我看到您在这里搅拌了很多罐子。 You have jars in Maven dependency, then jars in build path separately under C:\\eclipseHelios\\lib 您在Maven依赖项中有jar,然后在C:\\eclipseHelios\\lib下的构建路径中分别有jar

Could you please clean it up, and make sure that all the required jars are either in JRE lib or Maven dependency only. 您能否清理一下,并确保所有必需的jar都仅位于JRE lib或Maven依赖项中。 For ws jar, the maven config is 对于ws jar,maven配置为

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.1.7</version>
</dependency>

Also, I see many duplicate version of jars. 此外,我看到了许多重复的罐子版本。 eg jaxws-api.2.1.jar as well in maven. 例如jaxws-api.2.1.jar以及maven。 The more is the duplicate, more is class version clash! 重复项越多,类版本冲突越多!

Please clean your library and try again. 请清理您的书架,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM