Solr
  1. Solr
  2. SOLR-3087

XInclude not working on schema.xml

    Details

      Description

      I want to use XML XInclude mechanism (http://en.wikipedia.org/wiki/XInclude) to include parts of schema.xml.
      When I try to include a fieldType, I get this exception :

      java.lang.RuntimeException: schema fieldtype string2(org.apache.solr.schema.StrField) invalid arguments:

      {xml:base=solrres:/schema_integration.xml}

      at org.apache.solr.schema.FieldType.setArgs(FieldType.java:168)
      at org.apache.solr.schema.IndexSchema$1.init(IndexSchema.java:467)
      at org.apache.solr.schema.IndexSchema$1.init(IndexSchema.java:435)
      at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:175)
      at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:480)
      at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125)
      at org.apache.solr.core.CoreContainer.create(CoreContainer.java:461)
      at org.apache.solr.core.CoreContainer.load(CoreContainer.java:316)
      at org.apache.solr.core.CoreContainer.load(CoreContainer.java:207)
      at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:130)
      at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:94)
      at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.mortbay.start.Main.invokeMain(Main.java:194)
      at org.mortbay.start.Main.start(Main.java:534)
      at org.mortbay.start.Main.start(Main.java:441)
      at org.mortbay.start.Main.main(Main.java:119)
      at org.mortbay.jetty.win32service.JettyServiceWrapperListener.start(JettyServiceWrapperListener.java:47)
      at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)

      I include 'schema_integration.xml' like this :

      schema.xml ->
      <?xml version="1.0" encoding="UTF-8" ?>
      <schema name="default" version="1.1">
      <types>
      <!-- Stuff -->
      <xi:include href="schema_integration.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </types>

      <!-- Stuff -->
      </schema>

      schema_integration.xml ->
      <?xml version="1.0" encoding="UTF-8" ?>
      <fieldType name="string2" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>

      1. SOLR-3087.patch
        8 kB
        Hoss Man
      2. SOLR-3087.patch
        0.7 kB
        Amit Nithian

        Activity

        Hide
        Amit Nithian added a comment -

        I just ran into this too and think I found where you can fix it. Please see the patch. It's against trunk but will work with 4.0 BETA.

        Show
        Amit Nithian added a comment - I just ran into this too and think I found where you can fix it. Please see the patch. It's against trunk but will work with 4.0 BETA.
        Hide
        Hoss Man added a comment -

        assigning to myself to review patch for 4.0. anyone with an itch to deal with this should not hesitate to take it from me

        Show
        Hoss Man added a comment - assigning to myself to review patch for 4.0. anyone with an itch to deal with this should not hesitate to take it from me
        Hide
        Hoss Man added a comment -

        Romain: thanks for reporting this!

        Amit: thanks for your patch with a fix! .. your changed definitely addresses the specific bug reported, but i'm worried that it really only deals with the specific case of fieldType and it might leave other holes where code validates (or may be updated to valide in the future) that only expected attributes are used.

        So I've updated the patch to modify DOMUtil to ignore anything using the reserved xml namespace prefix. patch also improves on the existing TestXIncludeConfig to demonstrate this bug and that the fix is working.

        Show
        Hoss Man added a comment - Romain: thanks for reporting this! Amit: thanks for your patch with a fix! .. your changed definitely addresses the specific bug reported, but i'm worried that it really only deals with the specific case of fieldType and it might leave other holes where code validates (or may be updated to valide in the future) that only expected attributes are used. So I've updated the patch to modify DOMUtil to ignore anything using the reserved xml namespace prefix. patch also improves on the existing TestXIncludeConfig to demonstrate this bug and that the fix is working.
        Hide
        Amit Nithian added a comment -

        Perfect that makes sense! I didn't go that generic but hey that's what collaboration is for

        Show
        Amit Nithian added a comment - Perfect that makes sense! I didn't go that generic but hey that's what collaboration is for
        Hide
        Hoss Man added a comment -

        Committed revision 1387778.
        Committed revision 1387784. - 4x

        Show
        Hoss Man added a comment - Committed revision 1387778. Committed revision 1387784. - 4x
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1387784

        SOLR-3087: Fixed DOMUtil so that code doing attribute validation will automaticly ignore nodes in the resserved "xml" prefix (merge r1387778)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1387784 SOLR-3087 : Fixed DOMUtil so that code doing attribute validation will automaticly ignore nodes in the resserved "xml" prefix (merge r1387778)
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1383653

        SOLR-3087: CurrencyField now generates an appropriate error on schema init if it is configured as multiValued (merge r1383648)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1383653 SOLR-3087 : CurrencyField now generates an appropriate error on schema init if it is configured as multiValued (merge r1383648)
        Hide
        Uwe Schindler added a comment -

        Closed after release.

        Show
        Uwe Schindler added a comment - Closed after release.

          People

          • Assignee:
            Hoss Man
            Reporter:
            Romain MERESSE
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development