[infinispan-issues] [JBoss JIRA] (ISPN-5711) Component injection should deal with optional "provided" dependencies (i.e. javax.transaction)

Tristan Tarrant (JIRA) issues at jboss.org
Sat Aug 29 03:01:05 EDT 2015


Tristan Tarrant created ISPN-5711:
-------------------------------------

             Summary: Component injection should deal with optional "provided" dependencies (i.e. javax.transaction)
                 Key: ISPN-5711
                 URL: https://issues.jboss.org/browse/ISPN-5711
             Project: Infinispan
          Issue Type: Bug
            Reporter: Tristan Tarrant
            Assignee: Tristan Tarrant


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




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the infinispan-issues mailing list