I’ve been struggling for a short time to deploy Jenkins on IBM WebSphere Application Server 8.5, so here is a few tips.
First, Jenkins needs Java EE 7 or newer, it won’t work on Java EE 6. The official help is located here.
The main step is to configure the class loader to load the parent last, for the module and the application.
Applications > WebSphere enterprise applications > application_name > Class loading and update detection > Classes loaded with local class loader first (parent last)
Applications > WebSphere enterprise applications > application_name > Manage modules > Jenkins v1.xxx > Classes loaded with local class loader first (parent last)
What the documentation does not say, is that there is a conflict with WAS 8.5 because Jenkins tries to configure the JSESSION cookie for the path /. Basically you will get the following error message:
Could not invoke an operation on object: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=P8Node01,version=22.214.171.124,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=P8Node01Cell,spec=1.0 because of an mbean exception: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: SRVE8111E: The application, jenkins_war, is trying to modify a cookie which matches a pattern in the restricted programmatic session cookies list [domain=*, name=JSESSIONID, path=/].
To fix this, you can change the name of the cookie
Applications > WebSphere enterprise applications > application_name > Session management > Tick Override session management > Click Enable Cookies > Change cookie name JSESSIONID
You should also be able to remove the restriction in Global Security > Programmatic session cookie configuration but I haven’t tried that way.