Skip to content
- Problem: In a multimodular project, where multiple modules use the same libraries, you run into ClassCastExceptions for the same class or for interface and correctly implementing class.
- Solution: Do not add required libraries to each module separately.
Instead, wrap all libraries into a dedicated module from which you reexport all packages.
- Additional information: Each module uses it’s own classloader.
During runtime, the identity of a class is not only defined by its fully qualified classname but by it’s class loader as well, which is why “identical” classes loaded by different class loaders cause ClassCastExceptions.