-
Improvement
-
Resolution: Unresolved
-
Major
-
None
As described in Dependencies and Class Loading:
Java defines a Thread.getContextClassLoader(). Jenkins does not use this much; it will normally be set by the servlet container to the Jenkins core loader.
Unfortunately, JAXB has a design flaw in that JAXBContext#newInstance expects JAXB to be available in the thread's context class loader. With JAXB being detached to a separate plugin as of recent Java 11 changes, JAXB is no longer available in the Jenkins core loader. This causes a failure to load JAXB.
This plugin has been identified as containing such a call to JAXBContext#newInstance. The suggested solution is to wrap calls to JAXBContext#newInstance with a try/finally block to set the thread's context class loader to that of the plugin, which (by virtue of a plugin-to-plugin dependency on JAXB API plugin) enables JAXB to be loaded. See the following PR for an example:
[JENKINS-68503] Prepare Codebeamer Coverage Publisher for removal of JAXB and Java 11 requirement
Description |
New:
As described in [Dependencies and Class Loading|https://www.jenkins.io/doc/developer/plugin-development/dependencies-and-class-loading/]:
bq. Java defines a {{Thread.getContextClassLoader()}}. Jenkins does not use this much; it will normally be set by the servlet container to the Jenkins core loader. Unfortunately, JAXB has a design flaw in that {{JAXBContext#newInstance}} expects JAXB to be available in the thread's context class loader. With JAXB being detached to a separate plugin as of recent Java 11 changes, JAXB is no longer available in the Jenkins core loader. This causes a failure to load JAXB. This plugin has been identified as containing such a call to {{JAXBContext#newInstance} The suggested solution is to wrap calls to {{JAXBContext#newInstance}} with a {{try/finally}} block to set the thread's context class loader to that of the plugin, which (by virtue of a plugin-to-plugin dependency on JAXB API plugin) enables JAXB to be loaded. See the following PR for an example: https://github.com/jenkinsci/xcode-plugin/pull/113/files |
Description |
Original:
As described in [Dependencies and Class Loading|https://www.jenkins.io/doc/developer/plugin-development/dependencies-and-class-loading/]:
bq. Java defines a {{Thread.getContextClassLoader()}}. Jenkins does not use this much; it will normally be set by the servlet container to the Jenkins core loader. Unfortunately, JAXB has a design flaw in that {{JAXBContext#newInstance}} expects JAXB to be available in the thread's context class loader. With JAXB being detached to a separate plugin as of recent Java 11 changes, JAXB is no longer available in the Jenkins core loader. This causes a failure to load JAXB. This plugin has been identified as containing such a call to {{JAXBContext#newInstance} The suggested solution is to wrap calls to {{JAXBContext#newInstance}} with a {{try/finally}} block to set the thread's context class loader to that of the plugin, which (by virtue of a plugin-to-plugin dependency on JAXB API plugin) enables JAXB to be loaded. See the following PR for an example: https://github.com/jenkinsci/xcode-plugin/pull/113/files |
New:
As described in [Dependencies and Class Loading|https://www.jenkins.io/doc/developer/plugin-development/dependencies-and-class-loading/]:
bq. Java defines a {{Thread.getContextClassLoader()}}. Jenkins does not use this much; it will normally be set by the servlet container to the Jenkins core loader. Unfortunately, JAXB has a design flaw in that {{JAXBContext#newInstance}} expects JAXB to be available in the thread's context class loader. With JAXB being detached to a separate plugin as of recent Java 11 changes, JAXB is no longer available in the Jenkins core loader. This causes a failure to load JAXB. This plugin has been identified as containing such a call to {{JAXBContext#newInstance}}. The suggested solution is to wrap calls to {{JAXBContext#newInstance}} with a {{try/finally}} block to set the thread's context class loader to that of the plugin, which (by virtue of a plugin-to-plugin dependency on JAXB API plugin) enables JAXB to be loaded. See the following PR for an example: https://github.com/jenkinsci/xcode-plugin/pull/113/files |