You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Keith R. Bennett" <kb...@bbsinc.biz> on 2007/10/12 21:37:21 UTC

Re: TestParser Fails to Find config.xml

Do you all have any opinions about which class loader to use to load the
tika-config.xml file?  I used the one I was more familiar with, but Sami
brought up a question about it (see below).  Someone else I spoke with
suggested using both classloaders (try #1, if it fails, try #2).

- Keith


Sami Siren-2 wrote:
> 
> kbennett wrote:
> 
>> Is there another way we can specify the location of the config.xml file
>> that
>> would be more reliable?  Maybe by the following?:
>> 
>> URL configUrl = this.getClass().getResource("/config.xml");
> 
> This sounds like a good direction to me, I would however use a context
> classloader to find the resource and not a static one.
> 

-- 
View this message in context: http://www.nabble.com/TestParser-Fails-to-Find-config.xml-tf4418767.html#a13177786
Sent from the Apache Tika - Development mailing list archive at Nabble.com.


Re: TestParser Fails to Find config.xml

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On 10/13/07, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On 10/13/07, Robert Burrell Donkin <ro...@gmail.com> wrote:
> > On 10/12/07, Keith R. Bennett <kb...@bbsinc.biz> wrote:
> > > Do you all have any opinions about which class loader to use to load the
> > > tika-config.xml file?  I used the one I was more familiar with, but Sami
> > > brought up a question about it (see below).  Someone else I spoke with
> > > suggested using both classloaders (try #1, if it fails, try #2).
> >
> > trying the context classloader and then falling back to the class
> > classloader is the best approach
>
> IMHO this should be a client concern. Tika itself should only take an
> InputStream and not care where the configuration stream is coming
> from. I'm OK with the current utility methods that take a filename, a
> File, or a URL instead, but playing with classloaders is a sure sign
> of trouble.

+1

- robert

Re: TestParser Fails to Find config.xml

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 10/13/07, Robert Burrell Donkin <ro...@gmail.com> wrote:
> On 10/12/07, Keith R. Bennett <kb...@bbsinc.biz> wrote:
> > Do you all have any opinions about which class loader to use to load the
> > tika-config.xml file?  I used the one I was more familiar with, but Sami
> > brought up a question about it (see below).  Someone else I spoke with
> > suggested using both classloaders (try #1, if it fails, try #2).
>
> trying the context classloader and then falling back to the class
> classloader is the best approach

IMHO this should be a client concern. Tika itself should only take an
InputStream and not care where the configuration stream is coming
from. I'm OK with the current utility methods that take a filename, a
File, or a URL instead, but playing with classloaders is a sure sign
of trouble.

The original issue about TestParsers.java is easily solved, see
TIKA-62 and revision 584386.

BR,

Jukka Zitting

Re: TestParser Fails to Find config.xml

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On 10/12/07, Keith R. Bennett <kb...@bbsinc.biz> wrote:
>
> Do you all have any opinions about which class loader to use to load the
> tika-config.xml file?  I used the one I was more familiar with, but Sami
> brought up a question about it (see below).  Someone else I spoke with
> suggested using both classloaders (try #1, if it fails, try #2).

trying the context classloader and then falling back to the class
classloader is the best approach

- robert