A couple of thoughts...
Are you sure that you do not have a copy of your shared classes still packaged somewhere in your .war? Have a look at use-case #4 here
in regards to the HierarchialLoaderRepository class loader's precedence over the parent. The class is not loaded into the repositorie's cache until it is requested, and if it is deployed somewhere in your .war, and your .war is the first thing to request that class, the scoped version of that class will be returned.
So both of your .war's will have their own versions of the class, cached in their own repositories, which will be siblings of each other, which will cause the ClassCastException.
As an aside, are there other classes that you want to be isolated between these two .war's? It may be a silly question, but it's a little funny for me to see java2ClassLoadingCompliance set to true, then have a loader-repository configured as well.
Thank you for your answer.
Yes, I'm sure that I don't have a copy of my shared classes. If it was the case, I would have a ClassCastException, but I have a ClassNotFoundException.
And you are true, the parameter java2ClassLoadingCompliance doesn't change anything if my configuration.