ClassNotFoundExcpetion in IntelliJ 2019.1(with JDK 11 )

Answered

I am trying to make our plugin to work with both JDK 8 and JDK 11.

I am using jaxws-ri library in my project.

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

 

It works in development mode. However, when I create the artifact and install the plugin, it does not work. I get ClassNotFoundExcetpion pointing me to think that it's the third party file FactoryFinder. I loads UrlClassLoader instead of PluginClassLoader so it can not find classes.

 

I set the PluginClassLoader this wa: Thread.currentThread().getContextClassLoader(): - and it seems to work. But I'm wondering what's the side effect for IntelliJ (as I'm setting a different classloader) and also the effect of possibly conflicting with other plugins installed?

I believe it's similar to this question.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000272050-Different-ClassLoaders-Gradle-dependencies-

 

 

 

 

 

---

StackTrace

Caused by: 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.&lt;init&gt;(Service.java:112)
at com.coverity.ces.ws.testclient.DefectServiceService.&lt;init&gt;(DefectServiceService.java:49)
at com.coverity.desktop.model.services.impl.WebApiFactoryServiceImpl$2.get(WebApiFactoryServiceImpl.java:77)
at com.coverity.desktop.model.services.impl.WebApiFactoryServiceImpl$2.get(WebApiFactoryServiceImpl.java:74)
at com.coverity.desktop.model.services.impl.WebApiFactoryServiceImpl.createServiceWithTimeout(WebApiFactoryServiceImpl.java:167)
at com.coverity.desktop.model.services.impl.WebApiFactoryServiceImpl.createDefectServiceImpl(WebApiFactoryServiceImpl.java:74)
at com.coverity.desktop.model.services.impl.AbstractWebApiFactoryService.createDefectService(AbstractWebApiFactoryService.java:283)
... 112 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:257)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
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)
... 121 more

Please sign in to leave a comment.