We're having problems when we have a same dependency in two different modules.
For instance, we have the Module 1 with the Dependency A and we have Module 2 with the Dependency A as well.
When we have both modules started and we are using a feature from the Module 1, we have a ClassCast Exception related to a class inside Dependency A. We activated the Class Loaders log and we figured out that, even though we are using a feature from the Module 1, he JVM is loading Dependency A classes from both Module 1 and 2, causing the ClassCastException
Thread related to that problem:
I'm attaching the modules that we are required to reproduce the problem. Just create a new clean OpenMRS instalation (1.9.x) and add those modules. Also, it will be required create a bahmnicore.properties inside the .OpenMRS folder, this file is attached as well. It will be required create a patient_images folder inside .OpenMRS folder as well. Just do mkdir .OpenMRS/patient_images and it should be fine.
To trigger the bug, just access this url: