Issue with pdfbox-1.8.10 dependency while building custom actions

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
hari
Established Member

Issue with pdfbox-1.8.10 dependency while building custom actions

Hello, 

I am following the alfresco developer series by jeff potts and building custom actions. My requirement is to create custom actions such that they trigger when I upload a pdf and scan the document to perform actions like water marking, OCR, classification, content extraction etc. 

I see there is a plugin which does some of the things that I need called pdf-toolkit but it seems to be not working as expected with the latest version of alfresco. Hence I've started creating the custom actions on my own. 

I am using pdfbox 2.0.8 to work with pdf's and was able to successfully convert searchable/non searchable pdfs to text using it directly in java. I have added this version of pdfbox as the dependency to my alfresco project. 

Issue: Since alfresco automatically pulls in pdfbox 1.8.10, my version of pdfbox was not used and hence I am coming across the following issue. 

Caused by: java.lang.NoSuchMethodError: org.apache.pdfbox.pdmodel.PDDocument.getPage(I)Lorg/apache/pdfbox/pdmodel/PDPage; 

What options do I have ? What do you suggest ? 

1 Reply
afaust
Master

Re: Issue with pdfbox-1.8.10 dependency while building custom actions

You cannot / should not build any customisations / extensions of Alfresco that require / bundle different library versions than what is shipped with Alfresco. Such conflicts arise from classloading issues where parts / all of the code may be loaded from a library that is incompatible to what Alfresco is expecting in some place, or to what your extension may expect. The load order (which version "wins") is somewhat non-deterministic as it depends on both the JVM, application server classloader and the operating / file system.