Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5711

Component injection should deal with optional "provided" dependencies (i.e. javax.transaction)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 10.0.0.Final
    • None
    • None
    • None

      On initialization of the GlobalComponentRegistry, component injection attempts to resolve all classes for all methods in the declaration chain of all the components which might require injection.
      If we ever want to make some dependency truly optional (and "provided" at the maven dep level), we would need to ignore certain classes and inject nulls where necessary.

      Exception in thread "main" org.infinispan.commons.CacheException: Unable to construct a GlobalComponentRegistry!
      at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:136)
      at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:214)
      at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:134)
      at org.infinispan.tutorial.simple.map.InfinispanMap.main(InfinispanMap.java:10)
      Caused by: org.infinispan.commons.CacheException: Error injecting dependencies for component org.infinispan.notifications.cachemanagerlistener.CacheManagerNotifier
      at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:197)
      at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:156)
      at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:148)
      at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:114)
      ... 3 more
      Caused by: java.lang.NoClassDefFoundError: javax/transaction/Transaction
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.getDeclaredMethod(Class.java:2128)
      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:98)
      at org.infinispan.factories.AbstractComponentRegistry$Component.buildInjectionMethodsList(AbstractComponentRegistry.java:826)
      at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:195)
      ... 6 more
      Caused by: java.lang.ClassNotFoundException: javax.transaction.Transaction
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 12 more

              ttarrant@redhat.com Tristan Tarrant
              ttarrant@redhat.com Tristan Tarrant
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: