You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Penagos Jaime <Ja...@ub.uni-muenchen.de> on 2024/11/18 14:24:00 UTC

Apache Camel PDF Component

Hey everyone,

I've been testing some camel solr component (v 3.22.2) and I would like to send to solr the contents of PDF files (that support it), so I decided to use the PDF Component in Camel and I am not sure how to extract the information to test.




Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.TypeConversionException: Error during type conversion from type: org.apache.camel.component.file.GenericFile to the required type: org.apache.pdfbox.pdmodel.PDDocument with value GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException: No serializer found for class org.apache.camel.component.file.FileBinding and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.apache.camel.component.file.GenericFile["binding"])


Caused by: java.lang.IllegalArgumentException: No serializer found for class org.apache.camel.component.file.FileBinding and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.apache.camel.component.file.GenericFile["binding"])





From the info I could find on the website, it is focused on the latest version (4.8), but that's for us not applicable. Is there a way or some examples that I can refer to to understand what I am supposed to do?

I appreciate greatly any advice on this.




My routes look like this



from("file:appdata/etl/odlmu/folder"
          + "?"
          + "fileName=myTestPDF.pdf"
          + "&"
          + "noop=true"
)
          .id("route-to-test-components")
          .to("pdf:extractText" + "")
          .process((Exchange exchange) -> {
          })
          .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");





Best regards,
Jaime P.

AW: Apache Camel PDF Component

Posted by Penagos Jaime <Ja...@ub.uni-muenchen.de>.
Thanks folks, will check it out and keep you updated. Have a great day!

-----Ursprüngliche Nachricht-----
Von: Babak Vahdat <ba...@swissonline.ch.INVALID> 
Gesendet: Dienstag, 19. November 2024 13:45
An: users@camel.apache.org
Betreff: Re: Apache Camel PDF Component

Hi

Given your stack-trace, probably you’re running into (missing in 3.22.x):

https://issues.apache.org/jira/browse/CAMEL-21026

See also the related (fixed) bug by that ticket.

As Federico has already mentioned looking into the corresponding component tests is always a good idea. Just make sure you’re looking into the right version matching your Camel in use:

https://github.com/apache/camel/tree/camel-3.22.2/components/camel-pdf/src/test/java/org/apache/camel/component/pdf

--
Babak
 

> On 19 Nov 2024, at 13:11, Penagos Jaime <Ja...@ub.uni-muenchen.de> wrote:
> 
> Hi,
> 
> thanks for the reference, will check it out. 
> 
> Best regards
> 
> -----Ursprüngliche Nachricht-----
> Von: Federico Mariani <fe...@gmail.com>
> Gesendet: Dienstag, 19. November 2024 12:59
> An: users@camel.apache.org
> Betreff: Re: Apache Camel PDF Component
> 
> Hi,
> 
> I do not think there are camel-pdf examples, but you can find 
> something useful in the test component 
> https://github.com/apache/camel/tree/main/components/camel-pdf/src/tes
> t/java/org/apache/camel/component/pdf
> most of the Camel tests can be used as reference for your implementation.
> 
> Il giorno mar 19 nov 2024 alle ore 12:50 Penagos Jaime < Jaime.Penagos@ub.uni-muenchen.de> ha scritto:
> 
>> Hi again everyone,
>> 
>> is there maybe an example of the working PDF component? Does it map 
>> to PDDocument? Or do I need to use within a processor a manual use of it?
>> 
>> Again, thanks for any advice on this.
>> 
>> Best regards,
>> Jaime P.
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: Penagos Jaime <Ja...@ub.uni-muenchen.de>
>> Gesendet: Montag, 18. November 2024 15:24
>> An: 'users@camel.apache.org' <us...@camel.apache.org>
>> Betreff: Apache Camel PDF Component
>> 
>> Hey everyone,
>> 
>> I've been testing some camel solr component (v 3.22.2) and I would 
>> like to send to solr the contents of PDF files (that support it), so 
>> I decided to use the PDF Component in Camel and I am not sure how to 
>> extract the information to test.
>> 
>> 
>> 
>> 
>> Stacktrace
>> 
>> ---------------------------------------------------------------------
>> -
>> -----------------------------------------------------------------
>> org.apache.camel.TypeConversionException: Error during type 
>> conversion from type: org.apache.camel.component.file.GenericFile to 
>> the required
>> type: org.apache.pdfbox.pdmodel.PDDocument with value 
>> GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException:
>> No serializer found for class
>> org.apache.camel.component.file.FileBinding and no properties 
>> discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.camel.component.file.GenericFile["binding"])
>> 
>> 
>> Caused by: java.lang.IllegalArgumentException: No serializer found 
>> for class org.apache.camel.component.file.FileBinding and no 
>> properties discovered to create BeanSerializer (to avoid exception, 
>> disable
>> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.camel.component.file.GenericFile["binding"])
>> 
>> 
>> 
>> 
>> 
>> From the info I could find on the website, it is focused on the 
>> latest version (4.8), but that's for us not applicable. Is there a 
>> way or some examples that I can refer to to understand what I am supposed to do?
>> 
>> I appreciate greatly any advice on this.
>> 
>> 
>> 
>> 
>> My routes look like this
>> 
>> 
>> 
>> from("file:appdata/etl/odlmu/folder"
>>          + "?"
>>          + "fileName=myTestPDF.pdf"
>>          + "&"
>>          + "noop=true"
>> )
>>          .id("route-to-test-components")
>>          .to("pdf:extractText" + "")
>>          .process((Exchange exchange) -> {
>>          })
>> 
>> .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");
>> 
>> 
>> 
>> 
>> 
>> Best regards,
>> Jaime P.
>> 


Re: Apache Camel PDF Component

Posted by Babak Vahdat <ba...@swissonline.ch.INVALID>.
Hi

Given your stack-trace, probably you’re running into (missing in 3.22.x):

https://issues.apache.org/jira/browse/CAMEL-21026

See also the related (fixed) bug by that ticket.

As Federico has already mentioned looking into the corresponding component tests is always a good idea. Just make sure you’re looking into the right version matching your Camel in use:

https://github.com/apache/camel/tree/camel-3.22.2/components/camel-pdf/src/test/java/org/apache/camel/component/pdf

--
Babak
 

> On 19 Nov 2024, at 13:11, Penagos Jaime <Ja...@ub.uni-muenchen.de> wrote:
> 
> Hi,
> 
> thanks for the reference, will check it out. 
> 
> Best regards
> 
> -----Ursprüngliche Nachricht-----
> Von: Federico Mariani <fe...@gmail.com> 
> Gesendet: Dienstag, 19. November 2024 12:59
> An: users@camel.apache.org
> Betreff: Re: Apache Camel PDF Component
> 
> Hi,
> 
> I do not think there are camel-pdf examples, but you can find something useful in the test component https://github.com/apache/camel/tree/main/components/camel-pdf/src/test/java/org/apache/camel/component/pdf
> most of the Camel tests can be used as reference for your implementation.
> 
> Il giorno mar 19 nov 2024 alle ore 12:50 Penagos Jaime < Jaime.Penagos@ub.uni-muenchen.de> ha scritto:
> 
>> Hi again everyone,
>> 
>> is there maybe an example of the working PDF component? Does it map to 
>> PDDocument? Or do I need to use within a processor a manual use of it?
>> 
>> Again, thanks for any advice on this.
>> 
>> Best regards,
>> Jaime P.
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: Penagos Jaime <Ja...@ub.uni-muenchen.de>
>> Gesendet: Montag, 18. November 2024 15:24
>> An: 'users@camel.apache.org' <us...@camel.apache.org>
>> Betreff: Apache Camel PDF Component
>> 
>> Hey everyone,
>> 
>> I've been testing some camel solr component (v 3.22.2) and I would 
>> like to send to solr the contents of PDF files (that support it), so I 
>> decided to use the PDF Component in Camel and I am not sure how to 
>> extract the information to test.
>> 
>> 
>> 
>> 
>> Stacktrace
>> 
>> ----------------------------------------------------------------------
>> -----------------------------------------------------------------
>> org.apache.camel.TypeConversionException: Error during type conversion 
>> from type: org.apache.camel.component.file.GenericFile to the required
>> type: org.apache.pdfbox.pdmodel.PDDocument with value 
>> GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException: 
>> No serializer found for class 
>> org.apache.camel.component.file.FileBinding and no properties 
>> discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.camel.component.file.GenericFile["binding"])
>> 
>> 
>> Caused by: java.lang.IllegalArgumentException: No serializer found for 
>> class org.apache.camel.component.file.FileBinding and no properties 
>> discovered to create BeanSerializer (to avoid exception, disable
>> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.camel.component.file.GenericFile["binding"])
>> 
>> 
>> 
>> 
>> 
>> From the info I could find on the website, it is focused on the latest 
>> version (4.8), but that's for us not applicable. Is there a way or 
>> some examples that I can refer to to understand what I am supposed to do?
>> 
>> I appreciate greatly any advice on this.
>> 
>> 
>> 
>> 
>> My routes look like this
>> 
>> 
>> 
>> from("file:appdata/etl/odlmu/folder"
>>          + "?"
>>          + "fileName=myTestPDF.pdf"
>>          + "&"
>>          + "noop=true"
>> )
>>          .id("route-to-test-components")
>>          .to("pdf:extractText" + "")
>>          .process((Exchange exchange) -> {
>>          })
>> 
>> .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");
>> 
>> 
>> 
>> 
>> 
>> Best regards,
>> Jaime P.
>> 


AW: Apache Camel PDF Component

Posted by Penagos Jaime <Ja...@ub.uni-muenchen.de>.
Hi,

thanks for the reference, will check it out. 

Best regards

-----Ursprüngliche Nachricht-----
Von: Federico Mariani <fe...@gmail.com> 
Gesendet: Dienstag, 19. November 2024 12:59
An: users@camel.apache.org
Betreff: Re: Apache Camel PDF Component

Hi,

I do not think there are camel-pdf examples, but you can find something useful in the test component https://github.com/apache/camel/tree/main/components/camel-pdf/src/test/java/org/apache/camel/component/pdf
most of the Camel tests can be used as reference for your implementation.

Il giorno mar 19 nov 2024 alle ore 12:50 Penagos Jaime < Jaime.Penagos@ub.uni-muenchen.de> ha scritto:

> Hi again everyone,
>
> is there maybe an example of the working PDF component? Does it map to 
> PDDocument? Or do I need to use within a processor a manual use of it?
>
> Again, thanks for any advice on this.
>
> Best regards,
> Jaime P.
>
> -----Ursprüngliche Nachricht-----
> Von: Penagos Jaime <Ja...@ub.uni-muenchen.de>
> Gesendet: Montag, 18. November 2024 15:24
> An: 'users@camel.apache.org' <us...@camel.apache.org>
> Betreff: Apache Camel PDF Component
>
> Hey everyone,
>
> I've been testing some camel solr component (v 3.22.2) and I would 
> like to send to solr the contents of PDF files (that support it), so I 
> decided to use the PDF Component in Camel and I am not sure how to 
> extract the information to test.
>
>
>
>
> Stacktrace
>
> ----------------------------------------------------------------------
> -----------------------------------------------------------------
> org.apache.camel.TypeConversionException: Error during type conversion 
> from type: org.apache.camel.component.file.GenericFile to the required
> type: org.apache.pdfbox.pdmodel.PDDocument with value 
> GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException: 
> No serializer found for class 
> org.apache.camel.component.file.FileBinding and no properties 
> discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> org.apache.camel.component.file.GenericFile["binding"])
>
>
> Caused by: java.lang.IllegalArgumentException: No serializer found for 
> class org.apache.camel.component.file.FileBinding and no properties 
> discovered to create BeanSerializer (to avoid exception, disable
> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> org.apache.camel.component.file.GenericFile["binding"])
>
>
>
>
>
> From the info I could find on the website, it is focused on the latest 
> version (4.8), but that's for us not applicable. Is there a way or 
> some examples that I can refer to to understand what I am supposed to do?
>
> I appreciate greatly any advice on this.
>
>
>
>
> My routes look like this
>
>
>
> from("file:appdata/etl/odlmu/folder"
>           + "?"
>           + "fileName=myTestPDF.pdf"
>           + "&"
>           + "noop=true"
> )
>           .id("route-to-test-components")
>           .to("pdf:extractText" + "")
>           .process((Exchange exchange) -> {
>           })
>           
> .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");
>
>
>
>
>
> Best regards,
> Jaime P.
>

Re: Apache Camel PDF Component

Posted by Federico Mariani <fe...@gmail.com>.
Hi,

I do not think there are camel-pdf examples, but you can find something
useful in the test component
https://github.com/apache/camel/tree/main/components/camel-pdf/src/test/java/org/apache/camel/component/pdf
most of the Camel tests can be used as reference for your implementation.

Il giorno mar 19 nov 2024 alle ore 12:50 Penagos Jaime <
Jaime.Penagos@ub.uni-muenchen.de> ha scritto:

> Hi again everyone,
>
> is there maybe an example of the working PDF component? Does it map to
> PDDocument? Or do I need to use within a processor a manual use of it?
>
> Again, thanks for any advice on this.
>
> Best regards,
> Jaime P.
>
> -----Ursprüngliche Nachricht-----
> Von: Penagos Jaime <Ja...@ub.uni-muenchen.de>
> Gesendet: Montag, 18. November 2024 15:24
> An: 'users@camel.apache.org' <us...@camel.apache.org>
> Betreff: Apache Camel PDF Component
>
> Hey everyone,
>
> I've been testing some camel solr component (v 3.22.2) and I would like to
> send to solr the contents of PDF files (that support it), so I decided to
> use the PDF Component in Camel and I am not sure how to extract the
> information to test.
>
>
>
>
> Stacktrace
>
> ---------------------------------------------------------------------------------------------------------------------------------------
> org.apache.camel.TypeConversionException: Error during type conversion
> from type: org.apache.camel.component.file.GenericFile to the required
> type: org.apache.pdfbox.pdmodel.PDDocument with value
> GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException: No
> serializer found for class org.apache.camel.component.file.FileBinding and
> no properties discovered to create BeanSerializer (to avoid exception,
> disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> org.apache.camel.component.file.GenericFile["binding"])
>
>
> Caused by: java.lang.IllegalArgumentException: No serializer found for
> class org.apache.camel.component.file.FileBinding and no properties
> discovered to create BeanSerializer (to avoid exception, disable
> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> org.apache.camel.component.file.GenericFile["binding"])
>
>
>
>
>
> From the info I could find on the website, it is focused on the latest
> version (4.8), but that's for us not applicable. Is there a way or some
> examples that I can refer to to understand what I am supposed to do?
>
> I appreciate greatly any advice on this.
>
>
>
>
> My routes look like this
>
>
>
> from("file:appdata/etl/odlmu/folder"
>           + "?"
>           + "fileName=myTestPDF.pdf"
>           + "&"
>           + "noop=true"
> )
>           .id("route-to-test-components")
>           .to("pdf:extractText" + "")
>           .process((Exchange exchange) -> {
>           })
>           .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");
>
>
>
>
>
> Best regards,
> Jaime P.
>

AW: Apache Camel PDF Component

Posted by Penagos Jaime <Ja...@ub.uni-muenchen.de>.
Hi again everyone,

is there maybe an example of the working PDF component? Does it map to PDDocument? Or do I need to use within a processor a manual use of it?

Again, thanks for any advice on this. 

Best regards,
Jaime P.

-----Ursprüngliche Nachricht-----
Von: Penagos Jaime <Ja...@ub.uni-muenchen.de> 
Gesendet: Montag, 18. November 2024 15:24
An: 'users@camel.apache.org' <us...@camel.apache.org>
Betreff: Apache Camel PDF Component

Hey everyone,

I've been testing some camel solr component (v 3.22.2) and I would like to send to solr the contents of PDF files (that support it), so I decided to use the PDF Component in Camel and I am not sure how to extract the information to test.




Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.TypeConversionException: Error during type conversion from type: org.apache.camel.component.file.GenericFile to the required type: org.apache.pdfbox.pdmodel.PDDocument with value GenericFile[myTestPDF.pdf] due to java.lang.IllegalArgumentException: No serializer found for class org.apache.camel.component.file.FileBinding and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.apache.camel.component.file.GenericFile["binding"])


Caused by: java.lang.IllegalArgumentException: No serializer found for class org.apache.camel.component.file.FileBinding and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.apache.camel.component.file.GenericFile["binding"])





From the info I could find on the website, it is focused on the latest version (4.8), but that's for us not applicable. Is there a way or some examples that I can refer to to understand what I am supposed to do?

I appreciate greatly any advice on this.




My routes look like this



from("file:appdata/etl/odlmu/folder"
          + "?"
          + "fileName=myTestPDF.pdf"
          + "&"
          + "noop=true"
)
          .id("route-to-test-components")
          .to("pdf:extractText" + "")
          .process((Exchange exchange) -> {
          })
          .to("file:appdata/etl/odlmu/folder?fileName=myPDFOUTPUT.txt");





Best regards,
Jaime P.