cancel
Showing results for 
Search instead for 
Did you mean: 

Using newer bouncycastle libraries for my extension

matjazmuhic
Champ on-the-rise
Champ on-the-rise
Hi,

I'm trying to develop a PDF digital signing module with iText and bouncycastle. All works well outside Alfresco but since alfresco already uses bouncy castle (older version) my module didn't work. I did update the alfrescos bouncy castle libraries and now the signing works well but the verifying doesn't work.

Is there any way to package my Java extension code into JAR so that it will use newer libraries while Alfresco still uses older versions?
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

as long as your module resides in the same classloader of the Alfresco classloader hierarchy, you will not be able to reconcile version incompatibilities with the JAR bundled with Alfresco. What might work is the following - but I am not 100% sure, as I usually don't use that kind of approach:

  • try to extract the core of your module that needs to interact with iText and bouncycastle to a separate JAR WITHOUT ANY DEPENDENCY on Alfresco libraries or libraries bundled with Alfresco (that last part is crucial)

  • deploy the separate JAR into /tomcat/shared/lib - that way, it is in a different classloader (within the Alfresco classloader hierarchy): Alfresco will load its version of bouncycaslte from its classloader and not relegate to /tomcat/shared/lib, while your module loads it from a classloader that can't - even if it tried - load the incompatible version and has to use the newer one in /tomcat/shared/lib
Of course, it may be difficult to seperate your architecture in such a way, depending on the amount of interaction / data retrieval required.

Regards
Axel