1 Reply Latest reply on Oct 11, 2012 11:26 AM by jharting

    Problem producing infinispan Configuration and Cache

    khanser

      Hello,

       

      I am having a strange issue with CDI and my App (using infinispan). I have this code for the configuration:

       

      @ConfigureCache("preferences-local")
                @LocalPreferencesCache
          @Produces
          public Configuration localCache() {
              return new ConfigurationBuilder()
                                  .eviction()
                                  .strategy(EvictionStrategy.LRU)
                                  .maxEntries(100)
                              .build();
          }
      
                @ConfigureCache("preferences-local")
                @GlobalPreferencesCache
          @Produces
          public Configuration globalCache() {
              return new ConfigurationBuilder()
                                  .eviction()
                                  .strategy(EvictionStrategy.LRU)
                                  .maxEntries(100)
                              .build();
          }
      
      

       

      However the Infinispan Listener for the bean configuration production doesn't fires if I don't declare the ConfigurationBean as an EJB.

      Edit: Looking at the specification (http://docs.jboss.org/cdi/spec/1.0/html_single/#methods) if the methods were to be static they should execute but I tried and they don't.

      So the configuration now fires the listener but when I Inject my Cache in my code:

       

      @Inject @LocalPreferencesCache
                private AdvancedCache<String, Preference> localPreferences;
      
                @Inject @GlobalPreferencesCache
                private AdvancedCache<String, Preference> globalPreferences;
      
      

       

      In the @PostConstruct the preferences values are null. I debugged the Producers infinispan-cdi and they are not executing at all (so it's normal that my injections are null)

       

      The usual behavior is that those Producers should be fired withouth the need of being an EJB right? Am I missing something?

       

      I am using JBoss AS7.1.1 using weld core 1.1.9. Also I am using Infinispan 5.2.0.Alpha3 (Because I have 2 projects in my App server, this is an EAR with EJB's using infinispan and the other uses Switchyard. I read that Switchyard and infinispan have problems for infinispan prior to v5.2 and weld prior to 1.1.9 deployed in the same server or included as dependency)