The difference lies in the level of JAX-RS that the server is configured to use. WAS 9.0 includes selectable implementations of JAX-RS 1.1 and 2.0, with 2.0 being the default level, and I believe JAX-RS 1.1 might have been specified in your working WAS 8.5.5.x environment.
The mechanism of the failure is straightforward:
1) The JAX-RS API class, ClientBuilder, is loaded from the API included in the parent-last WAR class loader.
2) ClientBuilder uses the Java service mechanism to determine its implementation class. To do this, it calls getResourceAsStream() using the thread context class loader (that WAR loader) for a file named META-INF/services/javax.ws.rs.client.ClientBuilder, which will contain the name of the implementation class.
3) The descriptor is not included in any application jars. The application class loader delegates to its parents, and the file is found in WAS' JAX-RS implementation bundle, which declares IBM's implementation, JAXRSClientBuilderImpl.
4) When JAXRSClientBuilderImpl is defined, it links to the ClientBuilder API class available to its own class loader, the implementation included in WAS.
5) The caller now has visibility to two separate versions of the ClientBuilder API - directly to the version from its own class loader, and indirectly (via the WAS class) to the version packaged in WAS. This causes a LinkageError.
JAX-RS 1.1 does not contain the ClientBuilder class (and, by extension, does not contain a descriptor for the implementation), so the duplicate visibility for that class cannot occur in the working WAS8.5.5.x configuration.
------------------------------
GEETA NADELLA
------------------------------
Original Message:
Sent: Tue February 20, 2024 09:09 AM
From: Eric Chopard
Subject: java.lang.LinkageError after migrating from WebSphere Application Server v8.5.5.21 to v9.0.5.13
We recently migrated from WebSphere Application Server v8.5.5.21 to v9.0.5.13 after which
our application fails with the following error:SRVE8109W: Uncaught exception thrown by filter springSecurityFilterChain: java.lang.LinkageError: ClassCastException: attempting to castbundleresource://268.fwk-760850161/javax/ws/rs/client/ClientBuilder.class to wsjarWAS_INSTALL_ROOT/profiles/AppSrv01/installedApps/xxxCell/xxx.ear/xxx.war/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar!/javax/ws/rs/client/ClientBuilder.class
at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:97)
at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
.......
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:167)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:192)
at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:93)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:217)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:120)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:197)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:90)
at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:197)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:90)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:979)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1119)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:966)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1833)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)
We already followed the steps documented in this link but the errors still persist:
Using a third-party JAX-WS web services engine
Ibm |
remove preview |
|
Using a third-party JAX-WS web services engine |
In certain situations you might need to set up a third-party JAX-WS web services engine. For example, you must set up a third-party JAX-WS web services engine if you need to deploy applications that use a single run time across various application servers such as WebSphere Application Server, JBoss, and WebLogic, or if you want to build JAX-WS web services applications using third party JAX-WS run time such as CXF, Axis2, and Metro. |
|
|
|
------------------------------
Eric Chopard
------------------------------