迁移到雅加达:ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl [英] Migration to Jakarta: ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

查看:208
本文介绍了迁移到雅加达:ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 https://从Java 8迁移到Java 11并从EE切换到最新的Jakarta库时. wiki.eclipse.org/New_Maven_Coordinates 和Maven Central,我们在(仍基于SOAP的)客户端应用程序中获得了以下运行时异常:

While migrating from Java 8 to Java 11 and switching from EE to the newest Jakarta libraries according to https://wiki.eclipse.org/New_Maven_Coordinates and Maven central, we get the following runtime exception in our (still SOAP-based) client application:

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:31)
        at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:28)
        at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:73)
        at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:82)
        at javax.xml.ws.spi.Provider.provider(Provider.java:66)
        at javax.xml.ws.Service.<init>(Service.java:82)
        at [...]
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:60)
        at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:93)
        at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:71)
        ... 5 more

获得Java中描述的解决方案. lang.ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl尽管定义了依赖项不起作用,并且不使用Jakarta.

The solution described in Getting java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl despite the dependencies are defined doesn't work and doesn't use Jakarta.

如果我没记错的话,Jarkarta库中不应包含"com.sun.xml."包或引用,但 javax.xml.ws.spi.Provider 显然仍然可以引用此类:

If I'm not wrong, the Jarkarta libraries shouldn't contain "com.sun.xml."packages or reference such, but javax.xml.ws.spi.Provider obviously STILL DOES reference such class:

private static final String DEFAULT_JAXWSPROVIDER =
        "com.sun"+".xml.internal.ws.spi.ProviderImpl";

那么,有谁知道是否有一个与缺少的包含ProviderImpl的库等效的Jakarta,或者我如何解决Jakarta的问题?

So, does anyone know if there is a Jakarta equivalent to the missing library containing ProviderImpl, or how I could workaround the problem with Jakarta?

提前谢谢!

推荐答案

我终于找到了解决此问题的方法.根据中给出的答案如何在Java 11上使用WebServices?包javax.jws不存在 Java 11应包含 JAX-WS 的参考实现:

I finally found a workaround for my problem. According to the answer given in How to use WebServices on Java 11? package javax.jws does not exist the reference implementation of JAX-WS should be included with Java 11:

<dependency>
  <groupId>com.sun.xml.ws</groupId>
  <artifactId>jaxws-ri</artifactId>
  <version>2.3.2</version>
  <type>pom</type>
</dependency>

不幸的是,使用最新的maven-compile-plugin 3.8.0编译具有此依赖项的项目会导致 https://jira.apache.org/jira/browse/MCOMPILER-355 .应该在3.8.1中修复,但是该版本尚不可用.

Unfortunately, compiling our project with this dependency using the latest maven-compile-plugin 3.8.0 causes the exception described in https://jira.apache.org/jira/browse/MCOMPILER-355. It should be fixed in 3.8.1 but the version is not available yet.

作为一种解决方法,我让我们的项目使用了

As a workaround I got our project working with the hint given in Getting java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl despite the dependencies are defined, combined with an additional dependency (namely resolver that is also linked in the pom.xml of jaxws-ri) to avoid an subsequent java.lang.ClassNotFoundException: com.sun.org.apache.xml.internal.resolver.CatalogManager:

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

<dependency>
    <groupId>com.sun.org.apache.xml.internal</groupId>
    <artifactId>resolver</artifactId>
    <version>20050927</version>
</dependency>

也许这可以帮助遇到相同问题的人.

Maybe this helps someone running into the same problem.

这篇关于迁移到雅加达:ClassNotFoundException:com.sun.xml.internal.ws.spi.ProviderImpl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆