[英]java.lang.NoClassDefFoundError: org/apache/cxf/interceptor/AbstractBasicInterceptorProvider
[英]java.lang.NoClassDefFoundError: org/apache/cxf/service/invoker/Invoker
有誰知道如何解決這一問題? 我創建了一個客戶端來使用Web服務。 客戶端代碼為:
package cliente;
import java.util.List;
import handler.HeaderHandler;
import webservice.BoletinOficial;
import webservice.BoletinOficialService;
import petanuncio.PeticionAnuncio;
import respanuncio.RespuestaAnuncio;
import org.apache.cxf.jaxws.binding.DefaultBindingImpl;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.Handler;
import java.util.ArrayList;
public class Cliente {
/**
* Main
* @param args
*/
@SuppressWarnings("rawtypes")
public static void main(String[] args) {
String endpointURL = "";
try {
BoletinOficialService service = new BoletinOficialService();
BoletinOficial proxy = service.getBoletinOficialSoap11();
//rest of code
} catch (Exception e) {
e.printStackTrace();
}
}
問題是在運行程序並出現以下錯誤時,anc甚至無法創建“服務”:
Exception in thread "main" java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.apache.cxf.jaxws.spi.ProviderImpl could not be instantiated
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader(Unknown Source)
at javax.xml.ws.spi.Provider.provider(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at webservice.BoletinOficialService.<init>(BoletinOficialService.java:46)
at cliente.Cliente.main(Cliente.java:35)
Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/service/invoker/Invoker
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.service.invoker.Invoker
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
這個類和其他類是通過wsdl文件中的wsimport創建的,盡管我不認為這與我遇到的錯誤有關。 cxf-rt-frontend-jaxws-3.1.1.jar文件中的類org.apache.cxf.jaxws.spi.ProviderImpl是作為對項目的引用添加的。
我有什么想念的嗎? 先感謝您。
Invoker
是CXF API的一部分。 似乎缺少cxf-api。
如果使用maven,請添加依賴項:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>YOUR_VERSION</version>
</dependency>
否則將jar添加到您的類路徑中。
添加您在https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws/3.1.1上找到的編譯依賴項
更好的是,切換到Maven。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.