Thanks Mark. Just tried that. I put the redisson-tomcat jar outside of WEB-INF/lib and added it with scope provided. I get the exact same issue. What am I doing wrong?
Here's my code: HttpSession session = httpServletRequest.getSession(false); try { RedissonSessionManager rsm = (RedissonSessionManager) getManager(session); } catch (Exception e) { e.printStackTrace(); } private Manager getManager(HttpSession session) throws Exception { Field facadeSessionField = StandardSessionFacade.class.getDeclaredField("session"); facadeSessionField.setAccessible(true); StandardSession stdSession = (StandardSession) facadeSessionField.get(session); return stdSession.getManager(); } On Thu, May 7, 2020 at 11:52 PM Mark Thomas <ma...@apache.org> wrote: > On 07/05/2020 21:36, Jonathan Yom-Tov wrote: > > My application uses Redisson (a client which persists the session to > > Redis). There are two Redisson jar files located in $CATALINA_HOME/lib, > so > > if I understand the docs correctly they're loaded by the common class > > loader. > > > > I want to access the RedissonSessionManager class during a request. The > > problem is that if I do something like RedissonSessionManager manager = > > (RedissonSessionManager) session.getManager() I get a ClassCastException, > > presumably because they were loaded by different class loaders. > > > > Will it help if I somehow access the common class loader for this? If so > > how can I do that? If not is there some other way I can achieve this? > > Make sure you don't have those JARs in your application's WEB-INF/lib as > well as $CATALINA_BASE/lib. > > In any recent version of Tomcat any JAR in $CATALINA_BASE/lib will be > visible to your application. > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- [image: SysAid Technologies] <http://www.sysaid.com/?utm_source=signature&utm_medium=email&utm_campaign=sysaid-logo> Jonathan Yom-Tov Senior Architect jonathan.yom...@sysaid.com Phone (IL): +972 (3) 533-3675 Ext. 932 [image: SysAid Technologies] <https://www.sysaid.com/?utm_source=signature&utm_medium=email&utm_campaign=sysaid-logo-icon> [image: SysAid on Facebook] <https://www.facebook.com/SysAidIT> [image: SysAid on Twitter] <https://twitter.com/sysaid> [image: SysAid on Linked-in] <https://www.linkedin.com/company/sysaid-technologies-ltd> [image: SysAid on YouTube] <https://www.youtube.com/user/SysAidIT> [image: SysAid on Instagram] <https://www.instagram.com/sysaid_technologies/> [image: Banner] <https://www.sysaid.com/sig-link>