You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by aravinth thangasami <ar...@gmail.com> on 2020/06/25 04:41:16 UTC

ExceptionInInitializationError - PDDocument

Hi all,

We are facing this issue rarely, We will start processing in parallel
threads using Tika.
For PDF Files, The PDDocument class failed to initialize due to NPE on
ICC_Profile class.
As far I searched, I found https://issues.apache.org/jira/browse/FOP-2745 &
https://www.mail-archive.com/users@pdfbox.apache.org/msg11178.html

Caused by: java.lang.NullPointerException
> at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1768)
> at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1460)
> at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
> at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
> at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
> at
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
> at
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
> at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:106)
> ... 20 more
>

We are using OpenJDK 1.8.0_252.
Is there any way to solve the issue or any pointers would be helpful.


Thanks
Aravinth

Re: ExceptionInInitializationError - PDDocument

Posted by Tilman Hausherr <TH...@t-online.de>.
You could put the code mentioned below at the beginning of a class that 
you know that is called only once. (Maybe the Tika class ?)

Tilman

Am 25.06.2020 um 14:35 schrieb Tim Allison:
> Is there anything we can do at the Tika level to work around this bit of
> joy?
>
> On Thu, Jun 25, 2020 at 2:28 AM Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Hi,
>>
>> Sadly, this is a longtime PITA - this code segment was put there because
>> of a (different) problem in multithreaded code.
>>
>> I suggest you find a way to run that code before starting multithread
>> stuff.
>>
>>       /**
>>        * avoid concurrency issues with PDDeviceRGB
>>        */
>>       static
>>       {
>>           try
>>           {
>>               WritableRaster raster =
>> Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 1, 1, 3, new Point(0, 0));
>>               PDDeviceRGB.INSTANCE.toRGBImage(raster);
>>           }
>>           catch (IOException ex)
>>           {
>>               .....
>>           }
>>       }
>>
>>
>> Tilman
>>
>> Am 25.06.2020 um 06:41 schrieb aravinth thangasami:
>>> Hi all,
>>>
>>> We are facing this issue rarely, We will start processing in parallel
>>> threads using Tika.
>>> For PDF Files, The PDDocument class failed to initialize due to NPE on
>>> ICC_Profile class.
>>> As far I searched, I found
>> https://issues.apache.org/jira/browse/FOP-2745 &
>>> https://www.mail-archive.com/users@pdfbox.apache.org/msg11178.html
>>>
>>> Caused by: java.lang.NullPointerException
>>>> at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1768)
>>>> at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1460)
>>>> at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
>>>> at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
>>>> at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
>>>> at
>>>>
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
>>>> at
>>>>
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
>>>> at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:106)
>>>> ... 20 more
>>>>
>>> We are using OpenJDK 1.8.0_252.
>>> Is there any way to solve the issue or any pointers would be helpful.
>>>
>>>
>>> Thanks
>>> Aravinth
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: ExceptionInInitializationError - PDDocument

Posted by Tim Allison <ta...@apache.org>.
Is there anything we can do at the Tika level to work around this bit of
joy?

On Thu, Jun 25, 2020 at 2:28 AM Tilman Hausherr <TH...@t-online.de>
wrote:

> Hi,
>
> Sadly, this is a longtime PITA - this code segment was put there because
> of a (different) problem in multithreaded code.
>
> I suggest you find a way to run that code before starting multithread
> stuff.
>
>      /**
>       * avoid concurrency issues with PDDeviceRGB
>       */
>      static
>      {
>          try
>          {
>              WritableRaster raster =
> Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 1, 1, 3, new Point(0, 0));
>              PDDeviceRGB.INSTANCE.toRGBImage(raster);
>          }
>          catch (IOException ex)
>          {
>              .....
>          }
>      }
>
>
> Tilman
>
> Am 25.06.2020 um 06:41 schrieb aravinth thangasami:
> > Hi all,
> >
> > We are facing this issue rarely, We will start processing in parallel
> > threads using Tika.
> > For PDF Files, The PDDocument class failed to initialize due to NPE on
> > ICC_Profile class.
> > As far I searched, I found
> https://issues.apache.org/jira/browse/FOP-2745 &
> > https://www.mail-archive.com/users@pdfbox.apache.org/msg11178.html
> >
> > Caused by: java.lang.NullPointerException
> >> at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1768)
> >> at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1460)
> >> at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
> >> at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
> >> at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
> >> at
> >>
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
> >> at
> >>
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
> >> at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:106)
> >> ... 20 more
> >>
> > We are using OpenJDK 1.8.0_252.
> > Is there any way to solve the issue or any pointers would be helpful.
> >
> >
> > Thanks
> > Aravinth
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: ExceptionInInitializationError - PDDocument

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

Sadly, this is a longtime PITA - this code segment was put there because 
of a (different) problem in multithreaded code.

I suggest you find a way to run that code before starting multithread stuff.

     /**
      * avoid concurrency issues with PDDeviceRGB
      */
     static
     {
         try
         {
             WritableRaster raster = 
Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 1, 1, 3, new Point(0, 0));
             PDDeviceRGB.INSTANCE.toRGBImage(raster);
         }
         catch (IOException ex)
         {
             .....
         }
     }


Tilman

Am 25.06.2020 um 06:41 schrieb aravinth thangasami:
> Hi all,
>
> We are facing this issue rarely, We will start processing in parallel
> threads using Tika.
> For PDF Files, The PDDocument class failed to initialize due to NPE on
> ICC_Profile class.
> As far I searched, I found https://issues.apache.org/jira/browse/FOP-2745 &
> https://www.mail-archive.com/users@pdfbox.apache.org/msg11178.html
>
> Caused by: java.lang.NullPointerException
>> at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1768)
>> at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1460)
>> at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
>> at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
>> at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
>> at
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
>> at
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
>> at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:106)
>> ... 20 more
>>
> We are using OpenJDK 1.8.0_252.
> Is there any way to solve the issue or any pointers would be helpful.
>
>
> Thanks
> Aravinth
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: ExceptionInInitializationError - PDDocument

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

Sadly, this is a longtime PITA - this code segment was put there because 
of a (different) problem in multithreaded code.

I suggest you find a way to run that code before starting multithread stuff.

     /**
      * avoid concurrency issues with PDDeviceRGB
      */
     static
     {
         try
         {
             WritableRaster raster = 
Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 1, 1, 3, new Point(0, 0));
             PDDeviceRGB.INSTANCE.toRGBImage(raster);
         }
         catch (IOException ex)
         {
             .....
         }
     }


Tilman

Am 25.06.2020 um 06:41 schrieb aravinth thangasami:
> Hi all,
>
> We are facing this issue rarely, We will start processing in parallel
> threads using Tika.
> For PDF Files, The PDDocument class failed to initialize due to NPE on
> ICC_Profile class.
> As far I searched, I found https://issues.apache.org/jira/browse/FOP-2745 &
> https://www.mail-archive.com/users@pdfbox.apache.org/msg11178.html
>
> Caused by: java.lang.NullPointerException
>> at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1768)
>> at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1460)
>> at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
>> at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
>> at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
>> at
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
>> at
>> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
>> at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:106)
>> ... 20 more
>>
> We are using OpenJDK 1.8.0_252.
> Is there any way to solve the issue or any pointers would be helpful.
>
>
> Thanks
> Aravinth
>