classloading xsbs for pptx

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

classloading xsbs for pptx

Allison, Timothy B.
All,

  We have a report that Tika's integration with Solr is now failing proper classloading on a pptx with a CTTable that can't be loaded [1].
The error message suggests doing something like this: POIXMLTypeLoader.setClassLoader(CTTable.class.getClassLoader()).  Is this the right fix?  Should we do this at the Tika level or at the Solr level...or, longer term, should we do this within POI?

Thank you!

           Best,

                    Tim

[1] https://issues.apache.org/jira/browse/TIKA-2497

Reply | Threaded
Open this post in threaded view
|

Re: classloading xsbs for pptx

Javen O'Neal-2
> Should we do this at the Tika level or at the Solr level...or, longer
term, should we do this within POI?

Definitely POI. CTTable is an implementation detail of POI that we should
avoid leaking to outside libraries--even Tika.

On Nov 28, 2017 09:03, "Allison, Timothy B." <[hidden email]> wrote:

All,

  We have a report that Tika's integration with Solr is now failing proper
classloading on a pptx with a CTTable that can't be loaded [1].
The error message suggests doing something like this: POIXMLTypeLoader.
setClassLoader(CTTable.class.getClassLoader()).  Is this the right fix?
Should we do this at the Tika level or at the Solr level...or, longer term,
should we do this within POI?

Thank you!

           Best,

                    Tim

[1] https://issues.apache.org/jira/browse/TIKA-2497
Reply | Threaded
Open this post in threaded view
|

RE: classloading xsbs for pptx

Allison, Timothy B.
+1  Thank you.

We're about to start the release process for Tika 1.17.  Is there a way to fix this within Tika for now?

POIXMLTypeLoader.setClassLoader(x) is deprecated and in fact does nothing in POI-3.17.

See also SOLR-11693, where I ask for help w classloading in Solr.

The frustrating thing is that I can reproduce this with standalone Solr, but I can't reproduce it programmatically with straight Tika or even as a unit test within Solr.

Any and all help is appreciated!  Thank you!

Best,

             Tim


-----Original Message-----
From: Javen O'Neal [mailto:[hidden email]]
Sent: Tuesday, November 28, 2017 4:13 PM
To: POI Developers List <[hidden email]>
Subject: Re: classloading xsbs for pptx

> Should we do this at the Tika level or at the Solr level...or, longer
term, should we do this within POI?

Definitely POI. CTTable is an implementation detail of POI that we should avoid leaking to outside libraries--even Tika.

On Nov 28, 2017 09:03, "Allison, Timothy B." <[hidden email]> wrote:

All,

  We have a report that Tika's integration with Solr is now failing proper classloading on a pptx with a CTTable that can't be loaded [1].
The error message suggests doing something like this: POIXMLTypeLoader.
setClassLoader(CTTable.class.getClassLoader()).  Is this the right fix?
Should we do this at the Tika level or at the Solr level...or, longer term, should we do this within POI?

Thank you!

           Best,

                    Tim

[1] https://issues.apache.org/jira/browse/TIKA-2497

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

Reply | Threaded
Open this post in threaded view
|

Re: classloading xsbs for pptx

kiwiwings
Hi Tim,

last time when I've introduced the setClassLoader() method, it was helpful to have a minimal maven project
to showcase the error.
Can you setup a sample project?

When I changed the ClassLoader code last time with #61478, I've also used the same sample project [1]

Andi

[1] https://github.com/glucazeau/test-poi-sling



signature.asc (495 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: classloading xsbs for pptx

Yegor Kozlov-4
It seems to be fixed in 3.17. The snippet below fails with 3.16 but works
fine with  3.17 and  trunk

public static void main( String[] args ) throws Exception
{
    Thread thread = Thread.currentThread();
    ClassLoader cl = thread.getContextClassLoader();

    Thread th = new Thread(() -> {
        try {
            XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0]));
            for (XSLFSlide slide : ppt.getSlides()) {
                List<XSLFShape> shapes = slide.getShapes();
            }
        } catch (Exception e){
            e.printStackTrace(); // prints
"java.lang.IllegalStateException: Schemas (*.xsb) for CTTable can't be
loaded " with poi-3.16
        }
    });
    th.setContextClassLoader(cl.getParent());
    th.start();
    th.join();

}

Tim, you should be good to release with poi-3.17, the fix is already there.


Yegor


On Wed, Nov 29, 2017 at 2:25 AM, Andreas Beeker <[hidden email]>
wrote:

> Hi Tim,
>
> last time when I've introduced the setClassLoader() method, it was helpful
> to have a minimal maven project
> to showcase the error.
> Can you setup a sample project?
>
> When I changed the ClassLoader code last time with #61478, I've also used
> the same sample project [1]
>
> Andi
>
> [1] https://github.com/glucazeau/test-poi-sling
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: classloading xsbs for pptx

Allison, Timothy B.
You're right.  Thank you, Yegor.  I swapped out the 3.17-beta1 jars in Solr for the 3.17 jars, and I'm not getting that exception any more.

Onward!

Cheers,

                Tim

-----Original Message-----
From: Yegor Kozlov [mailto:[hidden email]]
Sent: Wednesday, November 29, 2017 5:50 AM
To: POI Developers List <[hidden email]>
Subject: Re: classloading xsbs for pptx

It seems to be fixed in 3.17. The snippet below fails with 3.16 but works fine with  3.17 and  trunk

public static void main( String[] args ) throws Exception {
    Thread thread = Thread.currentThread();
    ClassLoader cl = thread.getContextClassLoader();

    Thread th = new Thread(() -> {
        try {
            XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0]));
            for (XSLFSlide slide : ppt.getSlides()) {
                List<XSLFShape> shapes = slide.getShapes();
            }
        } catch (Exception e){
            e.printStackTrace(); // prints
"java.lang.IllegalStateException: Schemas (*.xsb) for CTTable can't be loaded " with poi-3.16
        }
    });
    th.setContextClassLoader(cl.getParent());
    th.start();
    th.join();

}

Tim, you should be good to release with poi-3.17, the fix is already there.


Yegor


On Wed, Nov 29, 2017 at 2:25 AM, Andreas Beeker <[hidden email]>
wrote:

> Hi Tim,
>
> last time when I've introduced the setClassLoader() method, it was
> helpful to have a minimal maven project to showcase the error.
> Can you setup a sample project?
>
> When I changed the ClassLoader code last time with #61478, I've also
> used the same sample project [1]
>
> Andi
>
> [1] https://github.com/glucazeau/test-poi-sling
>
>
>

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