gpt4 book ai didi

java.lang.NoClassDefFoundError : org/apache/cxf/service/invoker/Invoker

转载 作者:行者123 更新时间:2023-12-01 08:57:24 32 4
gpt4 key购买 nike

有人知道如何解决这个问题吗?我创建了一个客户端来使用网络服务。客户端代码为:

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();
}
}

问题是运行程序时出现以下错误,甚至无法创建“服务”:

 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

这个类和其他类是通过 wsimport 从 wsdl 文件创建的,尽管我不认为这与我收到的错误有关。类 org.apache.cxf.jaxws.spi.ProviderImpl 位于 cxf-rt-frontend-jaxws-3.1.1.jar 文件中,它被添加为项目的引用。

This is the project structure

These are the libraries

我有什么遗漏的吗?预先感谢您。

最佳答案

添加您在 https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws/3.1.1 找到的编译依赖项

更好,切换到 Maven。

关于java.lang.NoClassDefFoundError : org/apache/cxf/service/invoker/Invoker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41957992/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com