Rupert Westenthaler created STANBOL-1045:
--------------------------------------------

             Summary: SolrCommons need to override the ContextClassLoader when 
loading Solr Analyzers
                 Key: STANBOL-1045
                 URL: https://issues.apache.org/jira/browse/STANBOL-1045
             Project: Stanbol
          Issue Type: Improvement
            Reporter: Rupert Westenthaler
            Assignee: Rupert Westenthaler
            Priority: Minor


With Solr it is necessary to reset the ContextClassLoader to the Bundle 
ClassLoader when initializing Analyzers. This is because Solr also considers 
the ContextClassLoader for loading those classes and if Stanbol does run within 
an embedded OSGI environment this might result in Solr versions used by the 
host application to leak into OSGI. This usually results in ClassCastExceptions.

While the SolrServerAdapter (commons.solr.core) has done this already with the 
upgrade to Solr 4 this is now also necessary for the BundleActivators used by 
all commons.solr.extra modules. Otherwise those would find 
"META-INF/services/{solr-component}.properties" files via the 
ContextClassLoader pointing to class files of the host application. While 
loading the classes would work the cast to the according interface would end 
with an ClassCastException as the interface is loaded via 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

Reply via email to