-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
jenkins-2.332.3
crowd2-2.2.0
crowd2-plugin will no longer work once apache-httpcomponents-client-4-api is updated.
Steps to reproduce:
- Package latest master of https://github.com/jenkinsci/apache-httpcomponents-client-4-api-plugin. You'll get `apache-httpcomponents-client-4-api.hpi`.
docker run -it --rm -v "$(pwd):/workspace" -w /workspace maven:3.8.1-jdk-8 mvn package
- Launch a new Jenkins instance (docker run --rm -it -p 8080:8080 jenkins/jenkins:lts-alpine) and complete the initial wizard. You don't need to install any plugin here. "Select plugin to install" and selecting "None" does that.
- Install `apache-httpcomponents-client-4-api.hpi` in Manage Jenkins > Manage Plugins > Advanced > Deploy Plugin. Check "Restart Jenkins when installation is complete and no jobs are running"
- Install jaxb plugin in Manage Jenkins > Manage Plugins > Available.
- To see jaxb doesn't work even if it's installed, as crowd2 doesn't depend on that explicitly.
- Install crowd2 plugin in Manage Jenkins > Manage Plugins > Available.
- Go to Manage Jenkins > Configure Global Security. Run "Check Connection" with Crowd 2 in Security Realm. You don't need an actual crowd2 server and can use following dummy configurations as we just verify the connection behavior here:
-
- Crowd URL: http://localhost:8888/
- Application Name: Jenkins
- Application Password: Jenkins
-
- The check fails with "ERROR". It should fail with "The connection check failed." if crowd2 works properly.
Following stack trace is recorded in the system log:
2022-05-05 04:33:30.117+0000 [id=85] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/descriptorByName/de.theit.jenkins.crowd.CrowdSecurityRealm/testConnection java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1402) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1357) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1112) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) Caused: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at com.atlassian.crowd.integration.rest.service.RestCrowdClient.<init>(RestCrowdClient.java:92) at com.atlassian.crowd.integration.rest.service.factory.RestCrowdClientFactory.newInstance(RestCrowdClientFactory.java:26) ...
Why this happens?:
- apache-httpcomponents-client-4-api depends on jaxb as "Implied dependency". That's because apache-httpcomponents-client-4-api-4.5.13-1.0 targets Jenkins-2.60.3. Jenkins <= 2.163 contained jaxb in it, and Jenkins > 2.163 automatically injects jaxb to dependencies of any plugins targeting Jenkins <= 2.163.
- So crowd2 can access jaxb via apache-httpcomponents-client-4-api-4.5.13-1.0.
- apache-httpcomponents-client-4-api itself doesn't need jaxb, and it's supposed to no longer depends on jaxb once it target jenkins > 2.163. Crowd2 will be not able to access jaxb.
Resolution:
- Add dependency to jaxb explicitly in crowd2. Just instructed in https://plugins.jenkins.io/jaxb/.
- duplicates
-
JENKINS-68459 Prepare Crowd 2 Integration for removal of JAXB and Java 11 requirement
- Closed