1 Reply Latest reply on May 11, 2012 7:08 AM by galder.zamarreno

    Error creating cache on JBoss restart

    mglowacki

      hi,

       

           I have rewritten my TimerTasks to Quartz scheduler, now I got exception creating cache on JBoss startup:

       

      19:43:07,359 ERROR [offersTableData] org.infinispan.CacheException: Unable to construct a GlobalComponentRegistry!

      org.infinispan.CacheException: Unable to construct a GlobalComponentRegistry!

                at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:128)

                at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:298)

                at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:150)

                at com.domain.offer.offerting.cache.CacheManager.<init>(CacheManager.java:34)

                at com.domain.offer.offerting.cache.AllGamesCache.<init>(AllGamesCache.java:13)

                at com.domain.offer.offerting.cache.AllGamesCache.getInstance(AllGamesCache.java:18)

                at com.domain.offer.offerting.offers.offersTableData.init(offersTableData.java:57)

                at com.domain.offer.offerting.offers.offersTableData.<init>(offersTableData.java:46)

                at com.domain.offer.offerting.timertask.AllActiveGamesUpdater.<init>(AllActiveGamesUpdater.java:46)

                at com.domain.offer.offerting.scheduler.AllActiveGamesUpdateJob.execute(AllActiveGamesUpdateJob.java:17)

                at org.quartz.core.JobRunShell.run(JobRunShell.java:206)

                at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)

      Caused by: org.infinispan.config.ConfigurationException: Unable to instantiate ExecutorFactory for named component org.infinispan.executors.notification

                at org.infinispan.factories.NamedExecutorsFactory.construct(NamedExecutorsFactory.java:102)

                at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:286)

                at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:246)

                at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:83)

                at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:790)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:220)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:175)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:167)

                at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:113)

                ... 11 more

      Caused by: java.lang.ClassCastException: org.infinispan.executors.DefaultExecutorFactory cannot be cast to org.infinispan.executors.ExecutorFactory

                at org.infinispan.factories.NamedExecutorsFactory.buildAndConfigureExecutorService(NamedExecutorsFactory.java:117)

                at org.infinispan.factories.NamedExecutorsFactory.construct(NamedExecutorsFactory.java:63)

                ... 19 more19:43:07,359 ERROR [offersTableData] org.infinispan.CacheException: Unable to construct a GlobalComponentRegistry!

      org.infinispan.CacheException: Unable to construct a GlobalComponentRegistry!

                at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:128)

                at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:298)

                at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:150)

                at com.domain.offer.offerting.cache.CacheManager.<init>(CacheManager.java:34)

                at com.domain.offer.offerting.cache.AllbidsCache.<init>(AllbidsCache.java:13)

                at com.domain.offer.offerting.cache.AllbidsCache.getInstance(AllbidsCache.java:18)

                at com.domain.offer.offerting.offers.offersTableData.init(offersTableData.java:57)

                at com.domain.offer.offerting.offers.offersTableData.<init>(offersTableData.java:46)

                at com.domain.offer.offerting.timertask.AllActivebidsUpdater.<init>(AllActivebidsUpdater.java:46)

                at com.domain.offer.offerting.scheduler.AllActivebidsUpdateJob.execute(AllActivebidsUpdateJob.java:17)

                at org.quartz.core.JobRunShell.run(JobRunShell.java:206)

                at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)

      Caused by: org.infinispan.config.ConfigurationException: Unable to instantiate ExecutorFactory for named component org.infinispan.executors.notification

                at org.infinispan.factories.NamedExecutorsFactory.construct(NamedExecutorsFactory.java:102)

                at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:286)

                at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:246)

                at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:83)

                at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:790)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:220)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:175)

                at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:167)

                at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:113)

                ... 11 more

      Caused by: java.lang.ClassCastException: org.infinispan.executors.DefaultExecutorFactory cannot be cast to org.infinispan.executors.ExecutorFactory

                at org.infinispan.factories.NamedExecutorsFactory.buildAndConfigureExecutorService(NamedExecutorsFactory.java:117)

                at org.infinispan.factories.NamedExecutorsFactory.construct(NamedExecutorsFactory.java:63)

                ... 19 more

       

       

      Here is how I create it (Seam 2 component):

       

      @Name("quartzScheduler")

      @Scope(ScopeType.APPLICATION)

      @AutoCreate

      @Startup

      public class QuartzScheduler implements Serializable {

      ...

      simpleTrigger = newTrigger()

                                                        .withIdentity("allActivebidsUpdateJobTrigger",

                                                                            "bidsTriggerGroup")

                                                        .withSchedule(

                                                                            SimpleScheduleBuilder.repeatMinutelyForever(30))

                                                        .startAt(now.getTime()).usingJobData("updateAll", true)

                                                        .build();

                                    scheduler.scheduleJob(scheduleAllActivebidsUpdateJob(), simpleTrigger);

      ...

      }

       

      and a method execute() in AllActivebidsUpdateJob is getting cache which is defined this way:

       

      private final EmbeddedCacheManager cm;

      private static AllbidsCache _instance;

       

      protected CacheManager(String cacheName)

                    throws OperationsException, NullPointerException {

                          Configuration c = new ConfigurationBuilder().build();

                          this.cm = new DefaultCacheManager();

                          this.cm.defineConfiguration(cacheName, c);

              this.cache = cm.getCache(cacheName);       

          }

       

      public static getInstance() {

           if(_instance == null) {

                  _instance = new AllbidsCache();

              }

              return _instance;

      }

       

      the exception is thrown on line: this.cache = cm.getCache(cacheName)

       

      When I use it later (some time after server started, it works perfect). I use Infinispan 5.1.3

       

      Regards,

      Michal