8 Replies Latest reply on Jun 15, 2018 12:33 AM by kennardconsulting

    Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?

    kennardconsulting

      Hi everyone,

       

      Thanks for all your great work on Infinispan and WildFly! I'm trying to migrate the following programmatic cache configuration...

       

      mCacheManager.defineConfiguration( "foo", new ConfigurationBuilder()
      .eviction().strategy( EvictionStrategy.LIRS )
      .type( EvictionType.COUNT ).size( 7 )
      .persistence().addSingleFileStore().preload( true )
      .purgeOnStartup( false )
      .location( mConfigurationBean.getTmp() )
      .maxEntries( 25 )
      .build() );

       

      ...into WildFly's standalone.xml...

       

                      <local-cache name="wealthreportCache">
                          <eviction strategy="LIRS" max-entries="7"/>
                          <file-store relative-to="jboss.server.temp.dir" passivation="true" purge="false"/>
                      </local-cache>                
      

       

      I cannot understand how to map the file-store correctly. What is the equivalent to 'maxEntries 25'?

        • 1. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
          ryanemerson

          Hi Richard,

           

          You should be able to just set the max-entries attribute on the file-store element, i.e:

           

            <file-store relative-to="jboss.server.temp.dir" passivation="true" purge="false" preload="true" max-entries="25"/>  
          • 2. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
            kennardconsulting

            Thanks for your reply!

             

            Yes, it would be lovely if that worked. But on WildFly 10 I get:

             

            Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[261,21]
            Message: WFLYCTL0197: Unexpected attribute 'max-entries' encountered
            at org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute(ParseUtils.java:117)
            
            • 3. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
              ryanemerson

              The Infinispan version shipped with Wildfly 10 is no longer supported (it uses 8.1.0.Final and our current version is 9.2.5.Final) and is primarily intended for internal use by the server. I recommend utilising our provided wildfly-modules so that you can use the latest version of Infinispan. Note, you may need to upgrade to Wildfly 12 in order for the modules to work.

              • 4. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
                kennardconsulting

                I'm open to upgrading to WildFly 12. However, can you please confirm that file-store max-entries will work if I do?

                • 5. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
                  ryanemerson

                  If you utilise the Infinispan extension included in the wildfly-modules, then yes MAX_ENTRIES will be configurable for the file-store. If you utilise the internal Wildfly subsystem then I don't think that max-entries is available, however this is part of the Wildfly codebase not Infinispan.

                  • 6. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
                    kennardconsulting

                    Thanks for all your help so far.

                     

                    Okay I'm giving this a try. I'd like to stick on WildFly 10 if possible, and the documentation for Infinispan 9.0.x seems to suggest that's okay: Infinispan 9.0 User Guide

                     

                    I have downloaded the modules (as suggested by section 22.9.1 of the 9.0 User Guide) and updated my EJB JARs manifestEntries. I note the section on installing extensions (section 24.9.3. in the 9.2.x User Guide) is missing. But I only want to use EmbeddedCacheManager so I assume that's okay?

                     

                    However when I try and use the EmbeddedCacheManager I get the same error I've been always getting (see below). I believe this is because I'm trying to make use of WildFly's internal Infinispan installation, and encountering some horrible classloading problem between my WAR->EJB->EAR. I think I need a way to use an 'embedded' Infinispan without causing conflicting JARs. I was hoping the Infinispan module isolation would achieve this, but I don't think it's working?

                     

                    Do I need to do something else?

                     

                    org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke xxx.postConstruct() on xxx
                    at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:100)
                    at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81)
                    at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126)
                    at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:162)
                    at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
                    at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
                    at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
                    at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
                    at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
                    at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
                    .. 56 more
                    Caused by: org.infinispan.commons.CacheException: Unable to load component metadata!
                    at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:103)
                    at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:106)
                    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:248)
                    at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:194)
                    ... 61 more
                    Caused by: java.lang.NullPointerException
                    at org.infinispan.factories.components.ComponentMetadataRepo.readMetadata(ComponentMetadataRepo.java:33)
                    at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:101)
                    ... 66 more
                    
                    • 7. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
                      kennardconsulting

                      As another approach, I tried removing Infinispan from my MANIFEST.MF entirely. So now my app cannot 'see' WildFly's version of Infinispan at all. That's fine, so I tried shipping infinispan-embedded within my ejb/jar instead. But I keep getting:

                       

                      Caused by: org.infinispan.commons.CacheException: Unable to start cache loaders
                      at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:174)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                      at java.lang.reflect.Method.invoke(Method.java:498)
                      at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
                      ... 72 more
                      Caused by: org.infinispan.persistence.spi.PersistenceException: java.io.IOException: Unsupported protocol version 1
                      at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:135)
                      at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:141)
                      ... 77 more
                      Caused by: java.io.IOException: Unsupported protocol version 1
                      at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1249)
                      at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:128)
                      at org.infinispan.marshall.core.VersionAwareMarshaller.startObjectInput(VersionAwareMarshaller.java:142)
                      at org.infinispan.marshall.core.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:98)
                      at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:80)
                      at org.infinispan.persistence.file.SingleFileStore.rebuildIndex(SingleFileStore.java:212)
                      at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:126)
                      ... 78 more
                      
                      • 8. Re: Equivalent of SingleFileStore.maxEntries under WildFly's standalone.xml?
                        kennardconsulting

                        Okay solved this issue: for EJBs, you have to mark the Manifest Dependency as 'org.infinispan services export' (not just 'org.infinispan services'). So now I can use an EmbeddedCacheManager and configure my caches programmatically as normal.