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

Crowd 2 Integration is not compatible with Java 11

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • crowd2-plugin

      Hi,

      I don't know if it's me, but it seems that the Crowd2 plugin is not compatible with JDK11

      javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
       - with linked exception:
      [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:397)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
      	at com.atlassian.crowd.integration.rest.util.JAXBContextCache$1.load(JAXBContextCache.java:29)
      	at com.atlassian.crowd.integration.rest.util.JAXBContextCache$1.load(JAXBContextCache.java:25)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3568)
      	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313)
      	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228)
      	at com.google.common.cache.LocalCache.get(LocalCache.java:3965)
      	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969)
      	at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829)
      	at com.atlassian.crowd.integration.rest.util.JAXBContextCache.getJAXBContext(JAXBContextCache.java:41)
      	at com.atlassian.crowd.integration.rest.service.RestExecutor.getUnmarshaller(RestExecutor.java:414)
      	at com.atlassian.crowd.integration.rest.service.RestExecutor.access$000(RestExecutor.java:68)
      	at com.atlassian.crowd.integration.rest.service.RestExecutor$MethodExecutor.andReceive(RestExecutor.java:489)
      	at com.atlassian.crowd.integration.rest.service.RestCrowdClient.getGroup(RestCrowdClient.java:337)
      	at de.theit.jenkins.crowd.CrowdConfigurationService.getGroup(CrowdConfigurationService.java:519)
      	at de.theit.jenkins.crowd.CrowdConfigurationService.isGroupActive(CrowdConfigurationService.java:310)
      	at de.theit.jenkins.crowd.CrowdConfigurationService.isGroupMember(CrowdConfigurationService.java:675)
      	at de.theit.jenkins.crowd.CrowdConfigurationService.isGroupMember(CrowdConfigurationService.java:257)
      	at de.theit.jenkins.crowd.CrowdAuthenticationManager.authenticate(CrowdAuthenticationManager.java:114)
      	at org.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:74)
      	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:252)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1701)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:502)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
      	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:565)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
      	at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
      	... 68 more
      

      Exact same config work for jenkins/jenkins:2.176.3

      Regards,

      Valentin

        1. crowd_java_opt.png
          crowd_java_opt.png
          148 kB
        2. plugins.png
          plugins.png
          111 kB
        3. crowd2.png
          crowd2.png
          60 kB
        4. crowd2_2.png
          crowd2_2.png
          76 kB
        5. crowd_jaxb.png
          crowd_jaxb.png
          175 kB
        6. Screenshot 2019-09-10 at 19.46.24.png
          Screenshot 2019-09-10 at 19.46.24.png
          295 kB

          [JENKINS-59301] Crowd 2 Integration is not compatible with Java 11

          Ramon Leon added a comment -

          alecharp batmat could you take a look here please

          Ramon Leon added a comment - alecharp batmat could you take a look here please

          jonesbusy checking your plugin list, something seems wrong: you should have the jaxb plugin automatically installed when using JDK11.

          Could you please:

          • check if your issue goes away by manually installing the JAXB plugin (https://plugins.jenkins.io/jaxb)
          • see if you can provide a sufficiently isolated reproduction case for this issue?

          Thank you

          Baptiste Mathus added a comment - jonesbusy  checking your plugin list, something seems wrong: you should have the jaxb plugin automatically installed when using JDK11. Could you please: check if your issue goes away by manually installing the JAXB plugin ( https://plugins.jenkins.io/jaxb ) see if you can provide a sufficiently isolated reproduction case for this issue? Thank you

          Hi,

          Problem remains the same if the JAXB plugin is installed manually. It seems it's the only plugin causing this issue on our current deployment (we can see that all the job runs, but not possible to login into the instance.

          I've also found someone having the same issue : https://github.com/jenkinsci/jaxb-plugin/issues/7 (it was posted on the jaxb-plugin), but the stacktrace is the same. Related to the Crowd2 plugin.

          For the moment I don't have, and easy reproducible environment (we have all our infra deployed on K8S and helm).

          Will keep you updated if I'm able to reproduce it locally.

          Regards,

          Valentin Delaye added a comment - Hi, Problem remains the same if the JAXB plugin is installed manually. It seems it's the only plugin causing this issue on our current deployment (we can see that all the job runs, but not possible to login into the instance. I've also found someone having the same issue : https://github.com/jenkinsci/jaxb-plugin/issues/7 (it was posted on the jaxb-plugin), but the stacktrace is the same. Related to the Crowd2 plugin. For the moment I don't have, and easy reproducible environment (we have all our infra deployed on K8S and helm). Will keep you updated if I'm able to reproduce it locally. Regards,

          Hi again batmat

          Ok so in fact it was very very easy to reproduce locally...

          1) docker run -p 8080:8080 jenkins/jenkins:2.176.3-jdk11
          2) don't install any plugin at startup
          3) Just install the crowd2 plugin (it correctly fetch dependency)
          4) Enter just a fake crowd config and test to validate

          We can see the error is related to JAX-B.

          Thanks

          Valentin Delaye added a comment - Hi again batmat Ok so in fact it was very very easy to reproduce locally... 1) docker run -p 8080:8080 jenkins/jenkins:2.176.3-jdk11 2) don't install any plugin at startup 3) Just install the crowd2 plugin (it correctly fetch dependency) 4) Enter just a fake crowd config and test to validate We can see the error is related to JAX-B. Thanks

          Also same issue by forcing the JAXB implementation

          docker run -p 8080:8080 -e JAVA_OPTS=-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory jenkins/jenkins:2.176.3-jdk11

          Valentin Delaye added a comment - Also same issue by forcing the JAXB implementation docker run -p 8080:8080 -e JAVA_OPTS=-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory jenkins/jenkins:2.176.3-jdk11

          The good news is that we can totally reproduce this with mvn -Djenkins.version=2.176.3 hpi:run.

          I'm trying to see how I can fix this with a minimum of changes.

          Adrien Lecharpentier added a comment - The good news is that we can totally reproduce this with mvn -Djenkins.version=2.176.3 hpi:run . I'm trying to see how I can fix this with a minimum of changes.

          So, I have a problem. The context is loaded from Crowd Integration sources, which I have no access. This got me into looking into the library license, and I'm not sure if we are supposed to use it.

          Opening a INFRA ticket to discuss this.

          Adrien Lecharpentier added a comment - So, I have a problem. The context is loaded from Crowd Integration sources, which I have no access. This got me into looking into the library license, and I'm not sure if we are supposed to use it. Opening a INFRA ticket to discuss this.

          Hi alecharp, I merged your PR https://github.com/jenkinsci/crowd2-plugin/pull/35 to update the build.

          Martin Spielmann added a comment - Hi alecharp , I merged your PR  https://github.com/jenkinsci/crowd2-plugin/pull/35  to update the build.

          pingunaut thank you for that! I wasn't really done with it, as I wanted to add a unit-test which would show the bug. But I guess we wouldn't have seen the problem in the PR (because of the Jenkinsfile) and it would have meant that master branch would have been broken..

          I'll create another PR for the test, so that we can all work on trying to solve this. However, from what I have so far is that, as Crowd Integration library is calling JAXB, I cannot fix it on the plugin. (This is the way I managed to fix this in other plugins in the past)

          Adrien Lecharpentier added a comment - pingunaut thank you for that! I wasn't really done with it, as I wanted to add a unit-test which would show the bug. But I guess we wouldn't have seen the problem in the PR (because of the Jenkinsfile) and it would have meant that master branch would have been broken.. I'll create another PR for the test, so that we can all work on trying to solve this. However, from what I have so far is that, as Crowd Integration library is calling JAXB, I cannot fix it on the plugin. (This is the way I managed to fix this in other plugins in the past)

          Hi! Thanks for the updates!

          Do you think it's something that can be fix "easily" ?

          Thanks for the help and confirming the issue.

          Regards,

          Valentin Delaye added a comment - Hi! Thanks for the updates! Do you think it's something that can be fix "easily" ? Thanks for the help and confirming the issue. Regards,

          Adrien Lecharpentier added a comment - - edited

          jonesbusy sadly, I'm not confident that there is an easy way to fix this. The source code of the libray being hidden (most of it, we can still uncompile it) makes it really difficult for me to have a clear idea.

          I opened a second PR with a test to show the problem: https://github.com/jenkinsci/crowd2-plugin/pull/37

          Adrien Lecharpentier added a comment - - edited jonesbusy sadly, I'm not confident that there is an easy way to fix this. The source code of the libray being hidden (most of it, we can still uncompile it) makes it really difficult for me to have a clear idea. I opened a second PR with a test to show the problem: https://github.com/jenkinsci/crowd2-plugin/pull/37

          Hey Guys,

          I saw the discussion going on here and the concerns about hacking the pom due to the licensing using the proprietary library.

           

          As it turns out, Atlassian released an open source apache 2.0 licensed alternative to the library that utilizes the REST api namespace on the back end:

          https://jira.atlassian.com/browse/CWD-3008

          https://bitbucket.org/atlassian/crowd-rest-client

           

          I'm unsure how helpful this will be, but I just wanted to shed some light on this alternative library if it at all helps solve the issue at hand.

          Brian McCoskey added a comment - Hey Guys, I saw the discussion going on here and the concerns about hacking the pom due to the licensing using the proprietary library.   As it turns out, Atlassian released an open source apache 2.0 licensed alternative to the library that utilizes the REST api namespace on the back end: https://jira.atlassian.com/browse/CWD-3008 https://bitbucket.org/atlassian/crowd-rest-client   I'm unsure how helpful this will be, but I just wanted to shed some light on this alternative library if it at all helps solve the issue at hand.

          Running into exact same error when integrating crowd with jenkins. Here are my versions

          Crowd - 3.4

          Jenkins - [ 2.176.2|https://jenkins.io/]

          Jenkins JDK - OpenJDK11

          RENEESH KOTTAKKALATHIL added a comment - Running into exact same error when integrating crowd with jenkins. Here are my versions Crowd - 3.4 Jenkins - [ 2.176.2|https://jenkins.io/] Jenkins JDK - OpenJDK11

          Markus Glück added a comment -

          I also have the same issue here. Started in refactoring the plugin here: https://github.com/jenkinsci/crowd2-plugin/pull/39

          Actually adding the missing functions with the new proposed Crowd REST client (see above) wasn't that hard. Still struggling with the JAXB dependency though. First time I touched a Jenkins plugin, so maybe I'm missing something- 

          but have to switch over to other duties ATM  Hope this helps anyways.

          Markus Glück added a comment - I also have the same issue here. Started in refactoring the plugin here: https://github.com/jenkinsci/crowd2-plugin/pull/39 Actually adding the missing functions with the new proposed Crowd REST client (see above) wasn't that hard. Still struggling with the JAXB dependency though. First time I touched a Jenkins plugin, so maybe I'm missing something-  but have to switch over to other duties ATM  Hope this helps anyways.

          Stefan Ferstl added a comment -

          The plugin works when you add a JAXB-Implementation and its dependencies to JENKINS_HOME/war/WEB-INF/lib . These are the libraries of the implementation that formerly was part of the JDK (jaxb-runtime and its dependencies):

          org.glassfish.jaxb:jaxb-runtime:jar:2.3.0
          org.glassfish.jaxb:jaxb-core:jar:2.3.0
          javax.xml.bind:jaxb-api:jar:2.3.0
          org.glassfish.jaxb:txw2:jar:2.3.0 
          com.sun.istack:istack-commons-runtime:jar:3.0.5 
          org.jvnet.staxex:stax-ex:jar:1.7.8
          

          See also: Using JAXB in Java 9+

          Stefan Ferstl added a comment - The plugin works when you add a JAXB-Implementation and its dependencies to JENKINS_HOME/war/WEB-INF/lib . These are the libraries of the implementation that formerly was part of the JDK (jaxb-runtime and its dependencies): org.glassfish.jaxb:jaxb-runtime:jar:2.3.0 org.glassfish.jaxb:jaxb-core:jar:2.3.0 javax.xml.bind:jaxb-api:jar:2.3.0 org.glassfish.jaxb:txw2:jar:2.3.0 com.sun.istack:istack-commons-runtime:jar:3.0.5 org.jvnet.staxex:stax-ex:jar:1.7.8 See also: Using JAXB in Java 9+

          ferstl thank you for this workaround. On our side only four of them are needed txw2 is already there ( txw2-20110809.jar), stax-ex was not used.

          org.glassfish.jaxb:jaxb-runtime:jar:2.3.3
          org.glassfish.jaxb:jaxb-core:jar:2.3.0.1 or 3.0.0-M4
          javax.xml.bind:jaxb-api:jar:2.3.1 or 2.4.0-b180830.0359
          com.sun.istack:istack-commons-runtime:jar:3.0.11 or 4.0.0-M3
          

          Benjamin Brummer added a comment - ferstl thank you for this workaround. On our side only four of them are needed txw2 is already there ( txw2-20110809.jar), stax-ex was not used. org.glassfish.jaxb:jaxb-runtime:jar:2.3.3 org.glassfish.jaxb:jaxb-core:jar:2.3.0.1 or 3.0.0-M4 javax.xml.bind:jaxb-api:jar:2.3.1 or 2.4.0-b180830.0359 com.sun.istack:istack-commons-runtime:jar:3.0.11 or 4.0.0-M3

          Mark added a comment -

          Been running some tests and figured I would post the results.  Similarly to the previous comments, linking the libraries shipped in the JAXB Plugin into the Jenkins webroot directory (/var/cache/jenkins/war for an RPM install) allows the crowd2 plugin to function.  This implies that rebuilding the plugin with an explicit dependency on the JAXB Plugin should resolve the issue, however this does not seem to be the case in my testing.

           

           

          Mark added a comment - Been running some tests and figured I would post the results.  Similarly to the previous comments, linking the libraries shipped in the JAXB Plugin into the Jenkins webroot directory (/var/cache/jenkins/war for an RPM install) allows the crowd2 plugin to function.  This implies that rebuilding the plugin with an explicit dependency on the JAXB Plugin should resolve the issue, however this does not seem to be the case in my testing.    

          Here is my solution to the problem.

          https://github.com/jenkinsci/crowd2-plugin/pull/40

           

          Thomas Refflinghaus added a comment - Here is my solution to the problem. https://github.com/jenkinsci/crowd2-plugin/pull/40  

          Please don't remove the java11-compatibility tag again, it is used to create an overview page for all plugins at https://wiki.jenkins.io/display/JENKINS/Known+Java+11+Compatibility+issues

          Michael Keppler added a comment - Please don't remove the java11-compatibility tag again, it is used to create an overview page for all plugins at  https://wiki.jenkins.io/display/JENKINS/Known+Java+11+Compatibility+issues

          Bartosz Nowak added a comment - - edited

          I merged rifffi solution and release it today. It was working for me, for both Java 11 and Java 8.
          It's not a beautiful one, but I also can't came up with better one.
          In my opinion there is no need to invest more time in it if crowd will be dropped till 2024.

          Bartosz Nowak added a comment - - edited I merged rifffi  solution and release it today. It was working for me, for both Java 11 and Java 8. It's not a beautiful one, but I also can't came up with better one. In my opinion there is no need to invest more time in it if crowd will be dropped till 2024.

          Nice! Thanks.

          Morten Kristiansen added a comment - Nice! Thanks.

            dumam Bartosz Nowak
            jonesbusy Valentin Delaye
            Votes:
            15 Vote for this issue
            Watchers:
            30 Start watching this issue

              Created:
              Updated:
              Resolved: