Uploaded image for project: 'Stanbol (Retired)'
  1. Stanbol (Retired)
  2. STANBOL-772 Ease usage of the Stanbol Java API in embedded OSGI scenarios
  3. STANBOL-775

SolrServerPublishingComponent needs to intercept the ContextClassLoader when instantiating the SolrDispatchFilter

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • commons-0.11.0
    • Commons
    • None

    Description

      The "org.apache.solr.servlet.SolrDispatchFilter" initialises within the constructor the Solr Adminhandler via the context Classloader. Because of that any Apache Solr version used by the host system is leaking into Apache Stanbol running within the embedded OSGI environment.

      This causes Exceptions like

      org.apache.solr.common.SolrException: java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory
      at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:79) ~[solr-core-3.6.1.jar:3.6.1 1362471 - thetaphi - 2012-07-17 12:46:54]
      at org.apache.stanbol.commons.solr.web.dispatch.DelegatingSolrDispatchFilter.<init>(DelegatingSolrDispatchFilter.java:80) ~[na:na]
      at org.apache.stanbol.commons.solr.web.impl.SolrServerPublishingComponent$SolrFilter.<init>(SolrServerPublishingComponent.java:346) ~[na:na]
      at org.apache.stanbol.commons.solr.web.impl.SolrServerPublishingComponent.updateFilter(SolrServerPublishingComponent.java:303) ~[na:na]
      at org.apache.stanbol.commons.solr.web.impl.SolrServerPublishingComponent$1.addOrUpdate(SolrServerPublishingComponent.java:192) ~[na:na]
      at org.apache.stanbol.commons.solr.web.impl.SolrServerPublishingComponent$1.addingService(SolrServerPublishingComponent.java:219) ~[na:na]
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896) ~[stanbol-embedded-0.11.0-LMF-SNAPSHOT.jar:0.11.0-LMF-SNAPSHOT]

      To solve this the best options is that the SolrServerPublishingComponent replaces the context Classloader with the Bundle Classloader when instantiating the SolrFilter (line 304)

      Attachments

        Activity

          People

            Unassigned Unassigned
            rwesten Rupert Westenthaler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: