Re: how do I switch class loaders

2020-05-12 Thread Jonathan Yom-Tov
It was actually one of mine. I put a jar file under lib/ that I forgot had the offending class packaged into it. On Tue, May 12, 2020 at 5:13 PM Christopher Schultz < ch...@christopherschultz.net> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Jonathan, > > On 5/8/20 15:03,

Re: how do I switch class loaders

2020-05-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jonathan, On 5/8/20 15:03, Jonathan Yom-Tov wrote: > Got it! Using http://jhades.github.io/ it was quick and easy to > find out that the offending class was indeed loaded from two > different jar files. After I removed one of them casting worked >

Re: how do I switch class loaders

2020-05-08 Thread Jonathan Yom-Tov
Got it! Using http://jhades.github.io/ it was quick and easy to find out that the offending class was indeed loaded from two different jar files. After I removed one of them casting worked with no issues. I didn't know jar hell could result in ClassCastException, but you learn something new every

Re: how do I switch class loaders

2020-05-08 Thread Olaf Kock
On 08.05.20 19:50, Christopher Schultz wrote: > Olaf, > > On 5/8/20 13:19, Olaf Kock wrote: > > > You might want to hunt down duplicate classes in the JAR files on > > your classpath. Worst case: unpack them all in temporary > > directories and check for occurrences of the filename. Make sure >

Re: how do I switch class loaders

2020-05-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Olaf, On 5/8/20 13:19, Olaf Kock wrote: > > On 08.05.20 18:23, Jonathan Yom-Tov wrote: >> Oops, my bad  But that still leaves my original issue: why do I >> get a ClassCastException casting RedissonSessionManager to >> RedissonSessionManager? > >

Re: how do I switch class loaders

2020-05-08 Thread Olaf Kock
On 08.05.20 18:23, Jonathan Yom-Tov wrote: > Oops, my bad  But that still leaves my original issue: why do I get a > ClassCastException casting RedissonSessionManager to > RedissonSessionManager? The *only* reason that I've ever seen this happens (e.g. a class can't be typecast to a legitimate

Re: how do I switch class loaders

2020-05-08 Thread Jonathan Yom-Tov
Oops, my bad  But that still leaves my original issue: why do I get a ClassCastException casting RedissonSessionManager to RedissonSessionManager? On Fri, 8 May 2020, 16:56 Luis Rodríguez Fernández, wrote: > Hello Jonathan, > > It is not exactly the same :), look at the "$2" appended at the

Re: how do I switch class loaders

2020-05-08 Thread Luis Rodríguez Fernández
Hello Jonathan, It is not exactly the same :), look at the "$2" appended at the end.This is an "anonymous inner class" [1] Cheers, Luis [1] https://stackoverflow.com/questions/11388840/java-compiled-classes-contain-dollar-signs El vie., 8 may. 2020 a las 11:52, Jonathan Yom-Tov (<

Re: how do I switch class loaders

2020-05-08 Thread Jonathan Yom-Tov
This is very odd. I ran Tomcat with -verbose:class (see relevant output below). The class is being loaded twice from the same location, I'm guessing by two different class loaders. How can that be? [Loaded org.redisson.tomcat.RedissonSessionManager from

Re: how do I switch class loaders

2020-05-08 Thread Olaf Kock
On 08.05.20 09:37, Jonathan Yom-Tov wrote: > 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? Make sure, it's actually gone from your webapp. Depending on the deployment

Re: how do I switch class loaders

2020-05-08 Thread Jonathan Yom-Tov
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 =

Re: how do I switch class loaders

2020-05-07 Thread Mark Thomas
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

how do I switch class loaders

2020-05-07 Thread Jonathan Yom-Tov
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