You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Maciej Lizewski (JIRA)" <ji...@apache.org> on 2013/07/04 10:04:20 UTC

[jira] [Updated] (TIKA-1145) classloaders issue loading resources when extending Tika

     [ https://issues.apache.org/jira/browse/TIKA-1145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maciej Lizewski updated TIKA-1145:
----------------------------------

    Description: 
I noticed that ServiceLoader is using different classloader when loading 'services' like Parsers, etc (java.net.FactoryURLClassLoader) than MimeTypesFactory (org.eclipse.jetty.webapp.WebAppClassLoader) when loading mime types definitions. As result - it works completely different:

When jar with custom parser and custom-mimetypes.xml is added to solr.war - both resources are located and loaded (META-INF\services\org.apache.tika.parser.Parser and org\apache\tika\mime\custom-mimetypes.xml) and everything works fine.

When jar with custom parser is in Solr core lib and configured in solrconfig.xml - only META-INF\services\org.apache.tika.parser.Parser is loaded, but custom-mimetypes.xml is ignored.

MimeTypesFactory ignores custom classLoader provided in TikaConfig and always using only context provided one:
ClassLoader cl = MimeTypesReader.class.getClassLoader();

  was:
I noticed that ServiceLoader is using different classloader when loading 'services' like Parsers, etc (java.net.FactoryURLClassLoader) than MimeTypesFactory (org.eclipse.jetty.webapp.WebAppClassLoader) when loading mime types definitions. As result - it works completely different:

When jar with custom parser and custom-mimetypes.xml is added to solr.war - both resources are located and loaded (META-INF\services\org.apache.tika.parser.Parser and org\apache\tika\mime\custom-mimetypes.xml) and everything works fine.

When jar with custom parser is in Solr core lib and configured in solrconfig.xml - only META-INF\services\org.apache.tika.parser.Parser is loaded, but custom-mimetypes.xml is ignored.


ClassLoader cl = MimeTypesReader.class.getClassLoader();

    
> classloaders issue loading resources when extending Tika
> --------------------------------------------------------
>
>                 Key: TIKA-1145
>                 URL: https://issues.apache.org/jira/browse/TIKA-1145
>             Project: Tika
>          Issue Type: Bug
>          Components: config, mime
>    Affects Versions: 1.3
>         Environment: Tika as part of standard Solr distribution
>            Reporter: Maciej Lizewski
>
> I noticed that ServiceLoader is using different classloader when loading 'services' like Parsers, etc (java.net.FactoryURLClassLoader) than MimeTypesFactory (org.eclipse.jetty.webapp.WebAppClassLoader) when loading mime types definitions. As result - it works completely different:
> When jar with custom parser and custom-mimetypes.xml is added to solr.war - both resources are located and loaded (META-INF\services\org.apache.tika.parser.Parser and org\apache\tika\mime\custom-mimetypes.xml) and everything works fine.
> When jar with custom parser is in Solr core lib and configured in solrconfig.xml - only META-INF\services\org.apache.tika.parser.Parser is loaded, but custom-mimetypes.xml is ignored.
> MimeTypesFactory ignores custom classLoader provided in TikaConfig and always using only context provided one:
> ClassLoader cl = MimeTypesReader.class.getClassLoader();

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira