You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess since its possible to set the Thread classLoader, its possible to workaround, however i spent the last two weeks analyzing a situation where:
we have a WAR which happens to have CXF on its classpath fror whatever reason
the WAR has a "dependency" on different project of ours, however we only depend on an API (some interfaces) for that project, not the implementation
the implemenation of that dependency (and its classpath) is actually supplied at runtime by a 3rd party framework that loads the dependencies implementation through its own 3rd party classloader
(the 3rd party ClassLoader is "child first" so it picks up libraries from its own ClassPath first apparently)
the dependency that is loaded through this ClassLoader happens to require a specifc CXF transport extension library (which is on the 3rd party's classpath just like the main CXF lib, however not on the WAR classpath)
the WAR code happens to run the classes loaded from the different ClassLoader without creating a separate thread for them
those classes initiate a SOAP client
ServiceLoaderUtil then tries to find the CXF implementation on the wrong ClassLoader, because it is getting the ClassLoader from the WAR thread, instead of using the ClassLoader of its own class which should be the Third-Party-ClassLoader at that point
ServiceLoaderUtil then finds the unrelated CXF dependency from the WAR which does not come with the correct transport extenions, instead of finding the CXF with correct transports from the Third-Party Classpath
CXF fails to find the correct extension and throws an Exception
Maybe ClassLoaders are not meant to be used this way, which is entirely possible, because this 3rd party framework is quite old and certainly not following best practices in all regards.
The text was updated successfully, but these errors were encountered:
Hi,
is there a specific reason why ServiceLoaderUtil is using the ClassLoader from the current Thread instead of from its own class object?
See:
jax-ws-api/api/src/main/java/jakarta/xml/ws/spi/ServiceLoaderUtil.java
Line 102 in 0756262
I guess since its possible to set the Thread classLoader, its possible to workaround, however i spent the last two weeks analyzing a situation where:
Maybe ClassLoaders are not meant to be used this way, which is entirely possible, because this 3rd party framework is quite old and certainly not following best practices in all regards.
The text was updated successfully, but these errors were encountered: