Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
Hi, all I think I found the problem. When running with a LevelDB repository it fails but switching to a JDBC Repository it works. So somewhere deep in LevelDB then… M > On 25 Mar 2020, at 10:16, Mikael Andersson Wigander > wrote: > > Hi > > Yes, I tried that but maybe I implement4d it

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
Hi Yes, I tried that but maybe I implement4d it wrong: final List body = exchange.getIn().getBody(List.class); final Class aClass = body.get(0).getClass(); final CodeSource codeSource = aClass.getProtectionDomain().getCodeSource(); log.info("* onCompletion **");

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
Running inside IDE and also from a maven run, same issue M > On 25 Mar 2020, at 10:12, Maria Arias de Reyna Dominguez > wrote: > > Hi, > > So when debugging it fails and when not debugging it doesn't? > > Did you compile and run the test everything inside IntellijIDEA or are you > maybe

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Maria Arias de Reyna Dominguez
Hi, So when debugging it fails and when not debugging it doesn't? Did you compile and run the test everything inside IntellijIDEA or are you maybe compiling outside with plain maven and running on the IDE? I had this weird thing happening to me on eclipse several years ago and it was because

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Zoran Regvart
Hi Mikael, in the output you provided you're printing the name of the class, my remark was about the fact that in Java you can have the same named class loaded by two classloaders result in a ClassCastException. I also provided a way to check for that. zoran On Wed, Mar 25, 2020 at 9:59 AM

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
I implemented CompletionAwareAggregationStrategy and in onCompletion() I checked the class but it crashes with an Ex eption in there as well… > On 25 Mar 2020, at 09:59, Mikael Andersson Wigander > wrote: > > > >> On 25 Mar 2020, at 09:28, Zoran Regvart wrote: >> Thx > > I have tried

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
> On 25 Mar 2020, at 09:28, Zoran Regvart wrote: > Thx I have tried this and they are the same * onCompletion ** 2020-03-25 09:57:16.747 INFO 77480 --- [nio-8080-exec-9] s.t.m.u.ArrayListAggregationStrategy : Class: se.tradechannel.mifid.gateway.model.Gateway

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Zoran Regvart
Hi Mikael, ClassCastException with SameClass cannot be cast to SameClass means that there is an object passed from one classloader and being cast to a type loaded from another classloader. Look at the difference between obj.getClass() and SameClass.class, I usually check with

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
Well the computer never lies but when I revert to normal execution the code executes. I have tried to use the generics as in our production mode using aggregation with List but that gives me the same error… M > On 25 Mar 2020, at 08:50, Maria Arias de Reyna Dominguez > wrote: > > Hi, > >

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Mikael Andersson Wigander
Sorry Camel 2.25.0 Spring Boot 2.1.9.RELEASE M > On 25 Mar 2020, at 08:47, Claus Ibsen wrote: > > Hi > > What Camel version are you using? And what runtime do you use, karaf, spring > boot or something else? > > > On Wed, Mar 25, 2020 at 8:23 AM Mikael Andersson Wigander >

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Maria Arias de Reyna Dominguez
Hi, A very very wild guess: could it be a problem with dependencies so you have on your classpath two versions of the same class? The JVM should choose only one of them and use it, but to me it is clear it doesn't think that the first "se.tradechannel.mifid.gateway.model.Gateway" is the same as

Re: Aggregation mystery - ClassCastException on same class

2020-03-25 Thread Claus Ibsen
Hi What Camel version are you using? And what runtime do you use, karaf, spring boot or something else? On Wed, Mar 25, 2020 at 8:23 AM Mikael Andersson Wigander < mikael.grevs...@gmail.com> wrote: > TL;DR > > We have a very interesting mystery in one of our Camel applications. > > We have a