I am currently stuck in integrating Java packages because of a version conflict with BouncyCastle.
We have internally developed a component to handle data files sent to our local Revenue Service (not "the" IRS, but an equivalent tax authority in another European country) using official Java APIs provided and maintained by them. Another module of our platform uses a component from a Certification Authority to perform certified timestamping of files. Both have to be integrated into a single web application deployed at customer sites.
As you may know, BouncyCastle packages, on which both packages depend, have undergone several public API changes, so that consequent versions are no more binary compatible.
Revenue Service provides "cryptotools.jar" package which depends on the following:
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.49"/>
<dependency org="org.bouncycastle" name="bcpkix-jdk15on" rev="1.49"/>
Certification Authority's provides "jades-kernel" timestamping package which depends on
<dependency org="org.bouncycastle" name="bcmail-jdk15" rev="1.45"/>
<dependency org="org.bouncycastle" name="bcprov-jdk15" rev="1.45"/>
<dependency org="org.bouncycastle" name="bcprov-ext-jdk15" rev="1.45"/>
<dependency org="org.bouncycastle" name="bctsp-jdk15" rev="1.45"/>
Having both packages on classpath results in all BouncyCastle packages to be dumped into my WEB-INF/lib
folder, which normally doesn't sound bad
But if I try to start the web application with all of these packages inside I get an Error
saying that a class extends a final method. I won't post the stack trace, it's irrelevant for my question
If I remove any of the two versions (1.45 or 1.49) of BC, one of the modules won't compile. Well, they are both already compiled, so they won't simply link to their referenced classes/methods.
I have reported this situation to the CA (with which we have a maintenance contract for the Java APIs), using the older BC version (which has security vulnerabilities found by Black Duck, so that my customer is making my life painful). The CA is not cooperating yet. They would need to release a new version of their cryptography APIs compatible with more recent versions of BouncyCastle.
Me and my boss (C-level boss) are escalating the issue to CA hierarchy, and, according to our local humour, soon we will be escalating up to Francis
Mentioning humour, please allow me to share my current feeling in a visual fashion
Question time, now back to serious discussion
Suppose our vendor does not cooperate, or at least not timely for our regulatory deadlines. Revenue Service will not obviously downgrade their Java APIs to an older BC version.
How do we get out of this dependency hell? I know, for example, that log4j had a "bridge" package to mitigate breaking API changes between 1.x and 2.x versions for those packages who haven't upgraded yet. How do we make two modules coexist when they depend on different BC versions?
I will post a possible workaround but it's not our preferred solution.