2 Replies Latest reply on Mar 11, 2016 4:47 AM by tomysli

    Try setup Custom CacheStore, got "WFLYCTL0198: Unexpected element '{urn:infinispan:config:my-custom-store:0.0}my-custom-store' encountered"

    tomysli

      Hi Forum,

       

      I m trying to write a custom cache store, have followed the instruction from https://github.com/infinispan/infinispan/wiki/Custom-Cache-stores-(deployable), and https://github.com/infinispan/infinispan-cachestore-archetype

       

      I started with the module "cache-loader" created with the archetype, after fixing some minor errors in imports and readElement(), I build a "cache-loader-1.0-SNAPSHOT.jar".

      Then put the jar in ~/infinispan-server-8.2.0.Final/standalone/deployments, and start the server with standalone.sh, the jar can be deploy successfully.

       

      =========================================================================

       

       

        JBoss Bootstrap Environment

       

       

        JBOSS_HOME: /root/infinispan-server-8.2.0.Final

       

       

        JAVA: java

       

       

        JAVA_OPTS:  -server  -server -Xms64m -Xmx512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

       

       

      =========================================================================

       

       

      18:03:59,720 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final

      18:04:00,090 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final

      18:04:00,197 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: Infinispan Server 8.2.0.Final (WildFly Core 2.0.10.Final) starting

      18:04:02,016 INFO  [org.jboss.as.repository] (ServerService Thread Pool -- 2) WFLYDR0001: Content added at location /root/infinispan-server-8.2.0.Final/standalone/data/content/7b/b609563a2065cb9fa86a49b49b8cd945632d81/content

      18:04:02,044 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)

      18:04:02,074 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.3.4.Final

      18:04:02,100 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.3.4.Final

      18:04:02,189 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.18.Final

      18:04:02,207 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 20) Activating Infinispan subsystem.

      18:04:02,216 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 19) WFLYIO001: Worker 'default' has auto-configured to 2 core threads with 16 task threads based on your 1 available processors

      18:04:02,280 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 25) WFLYNAM0001: Activating Naming Subsystem

      18:04:02,290 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 29) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.

      18:04:02,305 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 27) WFLYSEC0002: Activating Security Subsystem

      18:04:02,324 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 18) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

      18:04:02,365 INFO  [org.jboss.as.connector] (MSC service thread 1-1) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)

      18:04:02,373 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=4.9.4.Final

      18:04:02,377 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2

      18:04:02,413 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service

      18:04:03,111 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]

      18:04:03,469 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "cache-loader-1.0-SNAPSHOT.jar" (runtime-name: "cache-loader-1.0-SNAPSHOT.jar")

      18:04:03,506 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /root/infinispan-server-8.2.0.Final/standalone/deployments

      18:04:03,821 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-2) DGISPN0007: Registering Deployed Cache Store service for store 'com.cityline.CustomCacheLoader'

      18:04:04,088 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-1) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.0.Final

      18:04:04,197 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-2) DGENDPT10000: REST starting

      18:04:04,767 INFO  [org.infinispan.expiration.impl.ExpirationManagerImpl] (MSC service thread 1-1) ISPN000025: wakeUpInterval is <= 0, not starting expired purge thread

      18:04:04,770 INFO  [org.infinispan.expiration.impl.ExpirationManagerImpl] (MSC service thread 1-2) ISPN000025: wakeUpInterval is <= 0, not starting expired purge thread

      18:04:04,775 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-2) DGISPN0001: Started default cache from local container

      18:04:04,775 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-1) DGISPN0001: Started namedCache cache from local container

      18:04:04,795 INFO  [org.infinispan.expiration.impl.ExpirationManagerImpl] (MSC service thread 1-1) ISPN000025: wakeUpInterval is <= 0, not starting expired purge thread

      18:04:04,800 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-1) DGISPN0001: Started memcachedCache cache from local container

      18:04:04,801 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10000: MemcachedServer starting

      18:04:04,805 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10001: MemcachedServer listening on 127.0.0.1:11211

      18:04:04,887 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-2) DGISPN0001: Started ___protobuf_metadata cache from local container

      18:04:04,918 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-2) DGISPN0001: Started ___script_cache cache from local container

      18:04:05,304 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10000: HotRodServer starting

      18:04:05,305 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10001: HotRodServer listening on 127.0.0.1:11222

      18:04:05,478 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10000: WebSocketServer starting

      18:04:05,484 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-1) DGENDPT10001: WebSocketServer listening on 127.0.0.1:8181

      18:04:05,668 INFO  [org.infinispan.rest.NettyRestServer] (MSC service thread 1-2) ISPN012003: REST server starting, listening on 127.0.0.1:8080

      18:04:05,672 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-2) DGENDPT10002: REST mapped to /rest

      18:04:05,712 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 17) WFLYSRV0010: Deployed "cache-loader-1.0-SNAPSHOT.jar" (runtime-name : "cache-loader-1.0-SNAPSHOT.jar")

      18:04:05,880 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management

      18:04:05,886 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990

      18:04:05,886 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Infinispan Server 8.2.0.Final (WildFly Core 2.0.10.Final) started in 6659ms - Started 176 of 182 services (46 services are lazy, passive or on-demand)

       

      Then stop the server, edit the ~/infinispan-server-8.2.0.Final/standalone/configuration/standalone.xml, add "<my-custom-store xmlns="urn:infinispan:config:my-custom-store:0.0" />" to the default cache.

       

              <subsystem xmlns="urn:infinispan:server:core:8.2" default-cache-container="local">

                  <cache-container name="local" default-cache="default" statistics="true">

                      <global-state/>

                      <local-cache name="default" start="EAGER">

                          <locking acquire-timeout="30000" concurrency-level="1000" striping="false"/>

                          <transaction mode="NONE"/>

                          <my-custom-store xmlns="urn:infinispan:config:my-custom-store:0.0" />

                      </local-cache>

                      <local-cache name="memcachedCache" start="EAGER">

                          <locking acquire-timeout="30000" concurrency-level="1000" striping="false"/>

                          <transaction mode="NONE"/>

                      </local-cache>

                      <local-cache name="namedCache" start="EAGER"/>

                  </cache-container>

              </subsystem>

       

      Start the server again and got error:

       

      =========================================================================

       

       

        JBoss Bootstrap Environment

       

       

        JBOSS_HOME: /root/infinispan-server-8.2.0.Final

       

       

        JAVA: java

       

       

        JAVA_OPTS:  -server  -server -Xms64m -Xmx512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

       

       

      =========================================================================

       

       

      18:07:55,407 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final

      18:07:55,772 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final

      18:07:55,884 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: Infinispan Server 8.2.0.Final (WildFly Core 2.0.10.Final) starting

      18:07:56,989 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration

              at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)

              at org.jboss.as.server.ServerService.boot(ServerService.java:356)

              at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)

              at java.lang.Thread.run(Thread.java:745)

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[137,21]

      Message: WFLYCTL0198: Unexpected element '{urn:infinispan:config:my-custom-store:0.0}my-custom-store' encountered

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

              at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseCacheElement(InfinispanSubsystemXMLReader.java:986)

              at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseLocalCache(InfinispanSubsystemXMLReader.java:720)

              at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseContainer(InfinispanSubsystemXMLReader.java:245)

              at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.readElement(InfinispanSubsystemXMLReader.java:95)

              at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.readElement(InfinispanSubsystemXMLReader.java:68)

              at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)

              at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69)

              at org.jboss.as.server.parsing.StandaloneXml_4.parseServerProfile(StandaloneXml_4.java:546)

              at org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:242)

              at org.jboss.as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:141)

              at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:103)

              at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:49)

              at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)

              at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)

              at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)

              ... 3 more

       

       

      18:07:57,003 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

      18:07:57,009 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested.

      18:07:57,035 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0050: Infinispan Server 8.2.0.Final (WildFly Core 2.0.10.Final) stopped in 4ms

        • 1. Re: Try setup Custom CacheStore, got "WFLYCTL0198: Unexpected element '{urn:infinispan:config:my-custom-store:0.0}my-custom-store' encountered"
          justinlinz

          Looking at the schema here:

          http://infinispan.org/schemas/infinispan-config-8.2.xsd

           

          I am wondering if the blue line in your config above should be changed to something like:

           

          <store name="customStore" class="org.your.custom.cache.package.name.here"/>
          

           

          An example of a test that has configuration for a custom cache store is located here:

           

          https://github.com/infinispan/infinispan/blob/2974aebce9bdb3aa0b1472b02fbd6bf01ee7dc1a/server/integration/testsuite/src/test/resources/config/infinispan/customcs.xml

           

          Thanks,

          Justin

          • 2. Re: Try setup Custom CacheStore, got "WFLYCTL0198: Unexpected element '{urn:infinispan:config:my-custom-store:0.0}my-custom-store' encountered"
            tomysli

            Thanks Justin!! the solution works like a charm.

             

            This time I try with the module "advanced-load-write-store", with <store class="com.tltest.CustomAdvancedLoadWriteStore"/> added to standalone.xml, the store can run and log successfully:

             

            17:22:59,911 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "advanced-load-write-store-1.0-SNAPSHOT.jar" (runtime-name: "advanced-load-write-store-1.0-SNAPSHOT.jar")

            17:23:00,513 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-2) DGISPN0007: Registering Deployed Cache Store service for store 'com.tltest.CustomAdvancedLoadWriteStore'

            17:23:00,790 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-1) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.0.Final

            17:23:00,895 INFO  [org.infinispan.server.endpoint] (MSC service thread 1-2) DGENDPT10000: REST starting

            17:23:00,900 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (MSC service thread 1-1) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

            17:23:00,902 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (MSC service thread 1-1) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

            17:23:00,905 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (MSC service thread 1-1) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

            17:23:01,450 INFO  [com.tltest.CustomAdvancedLoadWriteStore] (MSC service thread 1-2) init(),arg0=org.infinispan.persistence.InitializationContextImpl@12dbd2e

            17:23:01,451 INFO  [com.tltest.CustomAdvancedLoadWriteStore] (MSC service thread 1-2) start()


            But something still confuse me, the schema http://infinispan.org/schemas/infinispan-config-8.2.xsd is targeting namespace "urn:infinispan:config:8.2", while the <subsystem xmlns="urn:infinispan:server:core:8.2" default-cache-container="local"> in infinispan-server-8.2.0.Final/standalone/configuration/standalone.xml has namespace "urn:infinispan:server:core:8.2", they seems not matched.