[英]java.lang.NoClassDefFoundError: org/apache/cxf/service/invoker/Invoker
Does anyone know how to fix this? 有谁知道如何解决这一问题? I created a client to consume a webservice. 我创建了一个客户端来使用Web服务。 The client code is: 客户端代码为:
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();
}
}
The problem is when running the program and get the following error anc cannot even create "service": 问题是在运行程序并出现以下错误时,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
This class and others were created via wsimport from a wsdl file, althoug I don't think this is related to the error I am getting. 这个类和其他类是通过wsdl文件中的wsimport创建的,尽管我不认为这与我遇到的错误有关。 The class org.apache.cxf.jaxws.spi.ProviderImpl is in cxf-rt-frontend-jaxws-3.1.1.jar file whis is added as referece to the project. cxf-rt-frontend-jaxws-3.1.1.jar文件中的类org.apache.cxf.jaxws.spi.ProviderImpl是作为对项目的引用添加的。
Is there anything I am missing? 我有什么想念的吗? Thank you in advance. 先感谢您。
Invoker
is part of the CXF API. Invoker
是CXF API的一部分。 Looks like the cxf-api is missing. 似乎缺少cxf-api。
If you use maven, add the dependency : 如果使用maven,请添加依赖项:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>YOUR_VERSION</version>
</dependency>
Else add the jar to your classpath. 否则将jar添加到您的类路径中。
Add the compile dependencies you find at https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws/3.1.1 添加您在https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws/3.1.1上找到的编译依赖项
Better, switch to Maven. 更好的是,切换到Maven。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.