0

I've being having a trouble, i have a jar, that a partner created to read from a webservice implementing some wsdl handling, this was created in netbeans.

So I want to use this jar, when i use it, i get a NoClassDefFoundError, I think it happens because there are some library collission, so look at this from the stack trace:

NoClassDefFoundError org.codehaus.xfire.jaxws.JAXWSHelper
[...]
org.codehaus.xfire.jaxws.Provider.createServiceDelegate(Provider.java:32)
javax.xml.ws.Service.<init>(Service.java:56)
org.ubl.soap.test.SubmissionAPI.<init>(SubmissionAPI.java:44)

I'm using libraries from javax.xml.ws so it uses Service.java, so in that class in sometime it uses the class javax.xml.ws.Provider, but for some reason, it takes the same class in other library from org.codehaus.xfire.jaxws.

org.codehaus.xfire.jaxws comes from xfire.jar and javax.xml.ws comes from two jars i use in my project, one is axis2 and the other is jaxws-api.jar.

First thing that crossed my mind is if it's being taken the classes from axis2 instead of jaxws-api.jar then maybe the classes in axis2 aren't working as they are older, so if i wanna use the classes from jaxws-api.jar instead of the ones in axis2 what should i do ?

In the classpath, the two of them are defined, so the sames classes are defined, in different jars, but the namespaces are the same and i can't just remove axis2 cuz there is some of it the system is using...

so I know the error NoDefFoundClass is a run-time error, so maybe it's build correctly but in run-time is taking the classes from xfire instead of axis2...

4

1 に答える 1

1

Providerクラスのjavadocを見ると: http://docs.oracle.com/javase/6/docs/api/javax/xml/ws/spi/Provider.html#provider()

そこには次のように書かれています。

META-INF/services/javax.xml.ws.spi.Provider という名前のリソースが存在する場合、その最初の行が存在する場合は、実装クラスの UTF-8 エンコード名として使用されます。

したがって、そのファイルを作成し、使用するプロバイダーの名前を入れます。

問題は、呼び出しProvider.provider()て間違ったものを返すことです。

于 2013-05-20T19:57:35.213 に答える