Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58130

JAX-WS ClassNotFoundException javax.xml.ws.WebServiceException

    XMLWordPrintable

Details

    • 2.4.0

    Description

      Running Jenkins 2.181 got an ClassNotFoundException from CoverityPublisher on javax.xml.ws.WebServiceException.

      Attachments

        Activity

          basil Basil Crow added a comment -

          Released in 2.4.0.

          basil Basil Crow added a comment - Released in 2.4.0 .
          basil Basil Crow added a comment - Fixed in jenkinsci/synopsys-coverity-plugin#8 .
          basil Basil Crow added a comment -

          Actually looks like this was already done in jenkinsci/synopsys-coverity-plugin#8, so perhaps this bug should be marked as resolved in 2.4.0?

          basil Basil Crow added a comment - Actually looks like this was already done in jenkinsci/synopsys-coverity-plugin#8 , so perhaps this bug should be marked as resolved in 2.4.0?
          basil Basil Crow added a comment -

          Hi rotte, this is actually a common problem in Jenkins plugins. See this section of the developer documentation. The solution is to wrap your calls to JAX-WS in a try/finally that temporarily overrides the context class loader. See jenkinsci/jira-plugin#353 for example.

          basil Basil Crow added a comment - Hi rotte , this is actually a common problem in Jenkins plugins. See this section of the developer documentation . The solution is to wrap your calls to JAX-WS in a try/finally that temporarily overrides the context class loader. See jenkinsci/jira-plugin#353 for example.
          rotte Richard Otte added a comment - - edited

          Replying on behalf of Synopsys (as the developer of the Synopsys Coverity plugin),
          Investigating this extensively, it would appear that the root of this exception is a fundamental problem in Jenkins or JAX-WS. Briefly, JAX-WS has a ServiceLoaderUtil class shared among the SAAJ, JAXB, and JAXWS libraries to invoke java's ServiceLoader and get implementation classes, but it only ever invokes ServiceLoader.load(Class spiClass), the method that tries to load the class from the current thread's context ClassLoader.

          When the exception mentioned by Sverre occurs, the thread that is executing the Synopsys Coverity plugin code does not have the dynamic plugin ClassLoader as it's context ClassLoader-- instead it has the Jenkins WAR ClassLoader, which does not contain any of the JAX-WS classes.

          It appears that either:

          • JAX-WS has a bug and should be patched to not rely on the thread context ClassLoader, for example by also checking the spi class's ClassLoader
          • Jenkins has a bug and should be patched ensuring that threads executing plugin code always have a context ClassLoader that is the dynamic plugin ClassLoader

          In either case, does the Jenkins team have any suggestions for how to work around this problem? I admit I'm fairly new to the Jenkins Jira and I'm not quite sure who to tag.

          Edit: As context, my investigation was conducted while providing the missing JAX-WS classes as jar dependencies to the Synopsys Coverity plugin. I can provide a link to the branch on GitHub if further investigation is needed on the Jenkins side of things to see what I see.

          rotte Richard Otte added a comment - - edited Replying on behalf of Synopsys (as the developer of the Synopsys Coverity plugin), Investigating this extensively, it would appear that the root of this exception is a fundamental problem in Jenkins or JAX-WS. Briefly, JAX-WS has a ServiceLoaderUtil class shared among the SAAJ, JAXB, and JAXWS libraries to invoke java's ServiceLoader and get implementation classes, but it only ever invokes ServiceLoader.load(Class spiClass), the method that tries to load the class from the current thread's context ClassLoader. When the exception mentioned by Sverre occurs, the thread that is executing the Synopsys Coverity plugin code does not have the dynamic plugin ClassLoader as it's context ClassLoader-- instead it has the Jenkins WAR ClassLoader, which does not contain any of the JAX-WS classes. It appears that either: JAX-WS has a bug and should be patched to not rely on the thread context ClassLoader, for example by also checking the spi class's ClassLoader Jenkins has a bug and should be patched ensuring that threads executing plugin code always have a context ClassLoader that is the dynamic plugin ClassLoader In either case, does the Jenkins team have any suggestions for how to work around this problem? I admit I'm fairly new to the Jenkins Jira and I'm not quite sure who to tag. Edit: As context, my investigation was conducted while providing the missing JAX-WS classes as jar dependencies to the Synopsys Coverity plugin. I can provide a link to the branch on GitHub if further investigation is needed on the Jenkins side of things to see what I see.

          People

            synopsys_sig_jenkins Synopsys SIG
            djviking Sverre Moe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: