6 Replies Latest reply on Sep 2, 2014 1:58 PM by Richard Lucas

    Unable to configure indexes using the Wildfly 8.1 Subsystem

    Richard Lucas Apprentice

      I am currently running into issue configuring indexes using the Wildfly 8.1 subsystem.

       

      Below is an example:

       

      <subsystem xmlns="urn:jboss:domain:modeshape:2.0">
        <repository name="test-repo" cache-name="test-repo" cache-container="modeshape" security-domain="test-security">
        <workspaces>
        <workspace name="default">
        <initial-content>
                                  /apps/test/config/initial-test-content.xml
                              </initial-content>
        </workspace>
        </workspaces>
        <node-types>
        <node-type>/apps/test/config/stock/schema.cnd</node-type>
        </node-types>
        <index-providers>
        <index-provider name="stock" classname="org.modeshape.jcr.index.local.LocalIndexProvider" module="org.modeshape" path="/apps/test/indexes"/>
        </index-providers>
        <indexes>
        <index name="assetName" provider-name="stock" kind="value" node-type="asset:stock" columns="asset:name(STRING)"/>
        </indexes>
        </repository>
      </subsystem>
      

       

      This results in the error

       

      Message: JBAS014789: Unexpected element '{urn:jboss:domain:jaxrs:1.0}subsystem' encountered

        at org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:85) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]

        at org.jboss.as.controller.parsing.ParseUtils.nextElement(ParseUtils.java:76) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]

        at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:459) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]

        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:145) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]

        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]

        at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

        at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

        at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:104) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]

        ... 3 more

       

      I took a look at the ModeShape source code and found the following test:

           ModeShapeConfigurationTest.testOutputPersistenceOfConfigurationWithLocalFileIndexStorage()

      which uses:

           modeshape-local-file-index-storage.xml

      I checked this file the <index-provider> element is commented out

       

      <subsystem xmlns="urn:jboss:domain:modeshape:2.0">
        <repository name="sample"
                    cache-name="sample" cache-container="modeshape"
                    jndi-name="jcr/local/sample"
                    enable-monitoring="true"
                    security-domain="modeshape-security"
                    anonymous-roles="readonly readwrite admin connect"
                    anonymous-username="&lt;anonymous&gt;"
                    use-anonymous-upon-failed-authentication="false">
          <workspaces default-workspace="default" allow-workspace-creation="true">
            <workspace name="predefinedWorkspace1" />
            <workspace name="predefinedWorkspace2" />
            <workspace name="predefinedWorkspace3" />
          </workspaces>
          <index-providers>
              <!--
              <index-provider name="local-indexes" classname="local"
                    path="modeshape/sample/indexes/"
                    relative-to="jboss.server.data.dir"
                    />
              -->
          </index-providers>
          <sequencers>
            <sequencer name="modeshape-sequencer-ddl" classname="ddl" path-expression="//a/b" />
            <sequencer name="modeshape-sequencer-java" classname="java" path-expression="//a/b" />
          </sequencers>
        </repository>
      </subsystem>
      

       

      The test works as expected.

       

      If I uncomment the <index-provider> element the test fails

       

      <subsystem xmlns="urn:jboss:domain:modeshape:2.0">
          <repository name="sample"
                      cache-name="sample" cache-container="modeshape"
                      jndi-name="jcr/local/sample"
                      enable-monitoring="true"
                      security-domain="modeshape-security"
                      anonymous-roles="readonly readwrite admin connect"
                      anonymous-username="&lt;anonymous&gt;"
                      use-anonymous-upon-failed-authentication="false">
              <workspaces default-workspace="default" allow-workspace-creation="true">
                  <workspace name="predefinedWorkspace1"/>
                  <workspace name="predefinedWorkspace2"/>
                  <workspace name="predefinedWorkspace3"/>
              </workspaces>
              <index-providers>
                  <index-provider name="local-indexes" classname="local"
                                  path="modeshape/sample/indexes/"
                                  relative-to="jboss.server.data.dir"
                          />
              </index-providers>
              <sequencers>
                  <sequencer name="modeshape-sequencer-ddl" classname="ddl" path-expression="//a/b"/>
                  <sequencer name="modeshape-sequencer-java" classname="java" path-expression="//a/b"/>
              </sequencers>
          </repository>
      </subsystem>
      

       

      with the following error:

       

      javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1040]

      Message: JBAS014789: Unexpected element '{urn:jboss:domain:modeshape:2.0}sequencers' encountered

        at org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:85)

        at org.modeshape.jboss.subsystem.ModeShapeSubsystemXMLReader_2_0.readElement(ModeShapeSubsystemXMLReader_2_0.java:70)

        at org.modeshape.jboss.subsystem.ModeShapeSubsystemXMLReader_2_0.readElement(ModeShapeSubsystemXMLReader_2_0.java:34)

       

       

      Am I doing something wrong or is there an issue with configuring indexes via the Wildfly Subsystem?

       

      On a separate note is there an API for creating indexes so that you could programmatically create indexes at the same time you create node types?