简体   繁体   English

ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl

[英]ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

I have added all the relevant dependencies in build.gradle file.我已经在 build.gradle 文件中添加了所有相关的依赖项。 Still, geting below error when I try to run the Invoke SOAP service.尽管如此,当我尝试运行 Invoke SOAP 服务时仍然出现错误。 Shared dependencies section and error details.共享依赖项部分和错误详细信息。 Using Java 11. There are lot of answers already on internet, but none of it seems to be working.使用 Java 11. 互联网上已经有很多答案,但似乎都没有。 Any Help/Suggestion would be appreciable.任何帮助/建议都将是可观的。

dependencies {
    implementation 'org.codehaus.groovy:groovy-all:3.0.2'
    implementation 'javax.jws:javax.jws-api:1.1'

    cxfCodegen "jakarta.annotation:jakarta.annotation-api:1.3.5"
    cxfCodegen "jakarta.xml.ws:jakarta.xml.ws-api:2.3.3"
    cxfCodegen "jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"

    //implementation 'org.apache.cxf:cxf-spring-boot-starter-jaxws:3.5.0'
    //implementation 'javax.xml.bind:jaxb-api:2.3.1'
    compile 'javax.xml.ws:jaxws-api:2.3.1'

    implementation 'com.sun.xml.messaging.saaj:saaj-impl:2.0.1'
    implementation 'javax.xml.soap:javax.xml.soap-api:1.4.0'
    implementation 'javax.xml.soap:saaj-api:1.3.5'

    implementation 'com.sun.xml.ws:jaxws-rt:3.0.2'
    implementation 'com.sun.xml.ws:rt:3.0.2'
    implementation 'com.sun.xml.ws:jaxws-ri:3.0.2'
}

Getting below error stacktrace低于错误堆栈跟踪

Exception in thread "main" javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:61)
    at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58)
    at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103)
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112)
    at javax.xml.ws.spi.Provider.provider(Provider.java:96)
    at javax.xml.ws.Service.<init>(Service.java:112)
    at com.example.BLZService.<init>(BLZService.java:40)
    at dummypackage.DummySOAPClient.main(DummySOAPClient.java:21)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

    at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:90)
    at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:123)
    at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:101)
    ... 5 more

A2A: There are probably some issues in the internal referrencing may be. A2A:内部引用可能存在一些问题。

You can follow this answer: JDK 11;您可以遵循以下答案: JDK 11; JAX-WS; JAX-WS; Provider com.sun.xml.internal.ws.spi.ProviderImpl not found 未找到提供程序 com.sun.xml.internal.ws.spi.ProviderImpl

Basically the answer says you can try to include an older rt dependency as well:基本上答案说您也可以尝试包含较旧的 rt 依赖项:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>rt</artifactId>
    <version>2.3.1</version>
</dependency>

The above is maven pom xml format.以上是 maven pom xml 格式。

Here is gradle format for you:这是为您准备的 gradle 格式:

implementation 'com.sun.xml.ws:rt:2.3.1'

This will most probably resolve you issue.这很可能会解决您的问题。

EDIT: Post discussion in comments below:编辑:在下面的评论中发表讨论:

The dependencies that worked are:起作用的依赖项是:

implementation 'com.sun.xml.ws:jaxws-rt:2.3.2'
implementation 'com.sun.xml.ws:rt:2.3.2'
implementation 'com.sun.xml.ws:jaxws-ri:2.3.2'

After above dependecies, there was an error related to在上述依赖之后,出现了与

com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found

which can be resolved using the compatible SAAJ dependency:这可以使用兼容的 SAAJ 依赖项来解决:

implementation 'com.sun.xml.messaging.saaj:saaj-impl:1.5.1'

Also while adding header there was an issue in adding header to request after the above saaj dependencies were added:此外,在添加 header 时,在添加上述 saaj 依赖项后添加 header 以请求时出现问题:

Previous code:以前的代码:

SOAPMessageContext context; 
SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
SOAPHeader header = envelope.addHeader();

Updated code which works:更新的代码有效:

SOAPHeader header = envelope.getHeader();

Refer below link for jaxws-rt runtime dependencies:请参阅以下链接了解 jaxws-rt 运行时依赖项:

https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt/2.3.2 https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt/2.3.2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取 java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl 尽管定义了依赖项 - Getting java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl despite the dependencies are defined javax.xml.ws.WebServiceException:找不到提供者com.sun.xml.internal.ws.spi.ProviderImpl - javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found JDK 11; JAX-WS; 未找到提供程序 com.sun.xml.internal.ws.spi.ProviderImpl - JDK 11; JAX-WS; Provider com.sun.xml.internal.ws.spi.ProviderImpl not found Spring Boot 2.2 ClassNotFoundException com.sun.xml.ws.spi.ProviderImpl 使用 fat jar 从 Java 8 升级到 11 - Spring Boot 2.2 ClassNotFoundException com.sun.xml.ws.spi.ProviderImpl upgrading from Java 8 to 11 using fat jar 线程“主”中的异常com.sun.xml.internal.ws.spi.db.DatabindingException:com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException - Exception in thread “main” com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException com.sun.xml.internal.ws.fault.SOAPFaultBuilder的NoClassDefFoundError - NoClassDefFoundError for com.sun.xml.internal.ws.fault.SOAPFaultBuilder 编译时找不到com.sun.xml.internal.ws.developer.JAXWSProperties - com.sun.xml.internal.ws.developer.JAXWSProperties not found at compile com.sun.xml.internal.ws.client 不存在 - com.sun.xml.internal.ws.client does not exist 在Weblogic上部署Web服务时出错:无法转换为com.sun.xml.ws.spi.db.DatabindingProvider - Error deploying webservice on weblogic: cannot cast to com.sun.xml.ws.spi.db.DatabindingProvider JAXWS-RT:获取 com.sun.xml.ws.spi.db.DatabindingException 绑定一个简单的类 - JAXWS-RT: getting com.sun.xml.ws.spi.db.DatabindingException binding a simple class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM