简体   繁体   中英

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

After reading this article:

EAR & WAR Class Loader

and this artcle:

CXF JBOSS issue

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 :

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. 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.

Any ideas?

[edit:]

Inside lib/endored: jboss-jaxws jboss-jaxws-ext

Inside my EAR, I believe the jar tha conflicts is

jaxws-rt-2.1.7.jar

but take a look at e full jar list of my project

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

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

Could you please clean it up, and make sure that all the required jars are either in JRE lib or Maven dependency only. For ws jar, the maven config is

<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. The more is the duplicate, more is class version clash!

Please clean your library and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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