[ 
https://issues.apache.org/jira/browse/PDFBOX-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16957690#comment-16957690
 ] 

Joerg O. Henne commented on PDFBOX-4671:
----------------------------------------

[~tilman] thanks for bringing this issue to my attention.

[~lpanadero] thanks for your work analyzing the problem. First of all, let's 
talk about the reasoning behind the SPIs.

The reason why the cache is designed to be pluggable is that this way the 
memory management can integrate with a larger application. For example, the 
cache can be scoped to a document so that when the document is no longer used 
by the application, the associated JBIG2 cache resources are proactively 
purged. With the logging SPI, the reasoning is similar. You are right that 
SLF4j is being used practically universally. However, we still think that such 
a fundamental library should have as little external dependencies as possible.

That being said, we should try to dig deeper why the initialization fails with 
the SPIs in place and fix that issue at the core. I see that you included a 
test case. I cannot promise that I'll find time to look at it real soon. Could 
you, maybe, try to look into the class initialization to see whether there are 
any race conditions or the like causing the problem?

> NoClassDefFoundError: Could not initialize class 
> org.apache.pdfbox.jbig2.JBIG2ImageReader
> -----------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-4671
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4671
>             Project: PDFBox
>          Issue Type: Bug
>          Components: JBIG2
>    Affects Versions: 3.0.2 JBIG2
>            Reporter: Luis Panadero Guardeño
>            Priority: Major
>         Attachments: jbig2 servlet failcase.tar.gz
>
>
> JBIG2 ImageIO plugin sometimes does a NoClassDefFoundError
> I'm using TwelveMonkeys IIOProviderContextListener to fix the problem of 
> ImageIO with servlets, and additionally doing a 
> {{ImageIO}}.{{scanForPlugins}}(). But this keeps happening randomly. Any idea 
> where could be the problem ?
> This is happening with Tomcat 7  running over Oracle Java 8 (latest version)
>  
> {code:java}
> java.lang.NoClassDefFoundError: Could not initialize class 
> org.apache.pdfbox.jbig2.JBIG2ImageReader
>  at 
> org.apache.pdfbox.jbig2.JBIG2ImageReaderSpi.createReaderInstance(JBIG2ImageReaderSpi.java:117)
>  at 
> javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
>  at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:529)
>  at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513)
>  at org.apache.pdfbox.filter.Filter.findImageReader(Filter.java:155)
>  at org.apache.pdfbox.filter.JBIG2Filter.decode(JBIG2Filter.java:67)
>  at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:84)
>  at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
>  at 
> org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:241)
>  at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:735)
>  at 
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from1Bit(SampledImageReader.java:253)
>  at 
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:212)
>  at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:444)
>  at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:425)
>  at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1100)
>  at 
> org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:63)
>  at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
>  at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
>  at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
>  at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
>  at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:263)
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:321)
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243)
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:203)
>  at 
> com.digibis.digiimage.pdf.pdfbox.PdfBoxPdfProcessor.getImageFromDocumentPage(PdfBoxPdfProcessor.java:105){code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to