You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Katsuya Tomioka <ka...@gmail.com> on 2019/11/13 20:06:45 UTC

ForkParser in OSGi

I'd like to use ForkParser in OSGi with tika 1.22. The server seems to start up, but I'd get ClassNotFound from ClassLoaderProxy.java:119 soon as it tries to load anything  from either tika-core or tika-parsers.

I'm creating a ForkParser by:
    new ForkParser(ForkParser.class.getClassLoader(), parser);

where parser is an AutoDetectParser created with TikaConf.

Thanks,

-Katsuya


Re: ForkParser in OSGi

Posted by Katsuya Tomioka <ka...@gmail.com>.
Thanks for the suggestion. I'll give a try.

On 2019/11/14 18:07:46, Bob Paulin <bo...@apache.org> wrote: 
> Hi,
> 
> I have not used the ForkParser in an OSGi env before.  With OSGi the
> classloader constructor approach will be a bit complex.  OSGi isolates
> classloaders so depending on which classloader is passed from
> ForkParser.class.getClassLoader() it may not have access to all the
> parser classes it needs.  I would suggest trying a different approach by
> using the
> 
> public ForkParser(Path <http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html?is-external=true> tikaBin,
>                   ParserFactoryFactory <https://tika.apache.org/1.19/api/org/apache/tika/fork/ParserFactoryFactory.html> factoryFactory)
> 
> This constructor takes the OSGi classloader restrictions out and will
> just use the ForkClient as a communication device.  The classes in the
> forked tika server will load classes from the tika-app.jar in the
> tikaBin directory [1].   Hopefully that gets you a bit further.
> 
> - Bob
> 
> [1]https://tika.apache.org/1.22/api/org/apache/tika/fork/ForkParser.html#ForkParser-java.nio.file.Path-org.apache.tika.fork.ParserFactoryFactory-
> 
> 
> 
> On 11/13/2019 3:22 PM, Tim Allison wrote:
> > Paging Bob Paulin to the OSGi courtesy phone...
> >
> > On Wed, Nov 13, 2019 at 12:06 PM Katsuya Tomioka
> > <katsuya.tomioka@gmail.com <ma...@gmail.com>> wrote:
> >
> >     I'd like to use ForkParser in OSGi with tika 1.22. The server
> >     seems to start up, but I'd get ClassNotFound from
> >     ClassLoaderProxy.java:119 soon as it tries to load anything  from
> >     either tika-core or tika-parsers.
> >
> >     I'm creating a ForkParser by:
> >         new ForkParser(ForkParser.class.getClassLoader(), parser);
> >
> >     where parser is an AutoDetectParser created with TikaConf.
> >
> >     Thanks,
> >
> >     -Katsuya
> >
> 

Re: ForkParser in OSGi

Posted by Bob Paulin <bo...@apache.org>.
Hi,

I have not used the ForkParser in an OSGi env before.  With OSGi the
classloader constructor approach will be a bit complex.  OSGi isolates
classloaders so depending on which classloader is passed from
ForkParser.class.getClassLoader() it may not have access to all the
parser classes it needs.  I would suggest trying a different approach by
using the

public ForkParser(Path <http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html?is-external=true> tikaBin,
                  ParserFactoryFactory <https://tika.apache.org/1.19/api/org/apache/tika/fork/ParserFactoryFactory.html> factoryFactory)

This constructor takes the OSGi classloader restrictions out and will
just use the ForkClient as a communication device.  The classes in the
forked tika server will load classes from the tika-app.jar in the
tikaBin directory [1].   Hopefully that gets you a bit further.

- Bob

[1]https://tika.apache.org/1.22/api/org/apache/tika/fork/ForkParser.html#ForkParser-java.nio.file.Path-org.apache.tika.fork.ParserFactoryFactory-



On 11/13/2019 3:22 PM, Tim Allison wrote:
> Paging Bob Paulin to the OSGi courtesy phone...
>
> On Wed, Nov 13, 2019 at 12:06 PM Katsuya Tomioka
> <katsuya.tomioka@gmail.com <ma...@gmail.com>> wrote:
>
>     I'd like to use ForkParser in OSGi with tika 1.22. The server
>     seems to start up, but I'd get ClassNotFound from
>     ClassLoaderProxy.java:119 soon as it tries to load anything  from
>     either tika-core or tika-parsers.
>
>     I'm creating a ForkParser by:
>         new ForkParser(ForkParser.class.getClassLoader(), parser);
>
>     where parser is an AutoDetectParser created with TikaConf.
>
>     Thanks,
>
>     -Katsuya
>

Re: ForkParser in OSGi

Posted by Tim Allison <ta...@apache.org>.
Paging Bob Paulin to the OSGi courtesy phone...

On Wed, Nov 13, 2019 at 12:06 PM Katsuya Tomioka <ka...@gmail.com>
wrote:

> I'd like to use ForkParser in OSGi with tika 1.22. The server seems to
> start up, but I'd get ClassNotFound from ClassLoaderProxy.java:119 soon as
> it tries to load anything  from either tika-core or tika-parsers.
>
> I'm creating a ForkParser by:
>     new ForkParser(ForkParser.class.getClassLoader(), parser);
>
> where parser is an AutoDetectParser created with TikaConf.
>
> Thanks,
>
> -Katsuya
>
>