You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by "Rupert Westenthaler (JIRA)" <ji...@apache.org> on 2013/03/01 07:27:12 UTC

[jira] [Created] (STANBOL-970) TikaEngine may fail if XML framewoks are present in the Context ClassLoader

Rupert Westenthaler created STANBOL-970:
-------------------------------------------

             Summary: TikaEngine may fail if XML framewoks are present in the Context ClassLoader
                 Key: STANBOL-970
                 URL: https://issues.apache.org/jira/browse/STANBOL-970
             Project: Stanbol
          Issue Type: Bug
          Components: Engine - Tika
    Affects Versions: enhancement-engines-0.10.0
         Environment: Should only affect usages where Stanbol runs within an Embedded OSGI environment and the host application uses XML framewoks
            Reporter: Rupert Westenthaler
            Assignee: Rupert Westenthaler
            Priority: Minor


This is caused if the context ClassLoader (Thread#getContextClassLoader) provides Implementations of XML frameworks. 

Most Java XML libs prefer to load implementations by using the Thread#getContextClassLoader(). However OSGI has no control over this ClassLoader. Because of that there can be situations where Interfaces are loaded via the Bundle Classloader and the implementations are taken from the context Classloader. 

Reported Exception can be very manifold. Typically one would expect ClassCastException mentioning the same class two time. However more often Errors such as ExceptionInInitializerError are reported, as loading of implementations is often done by static members (or static blocks) and the JVM can not report the real exception in such cases.

The only workaround for this problem is resetting the context ClassLoader with the bundle ClassLoader.

--
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