aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Łukasz Dywicki (JIRA) <j...@apache.org>
Subject [jira] [Commented] (ARIES-960) ComponentDefinitionException: Unable to find a matching constructor - cannot create beans with generics
Date Wed, 21 Dec 2016 12:46:59 GMT

    [ https://issues.apache.org/jira/browse/ARIES-960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15766972#comment-15766972
] 

Łukasz Dywicki commented on ARIES-960:
--------------------------------------

I checked your branch and it works better but still fails with service tracker case. See exception
below. This happens when constructing service tracker instance for first generic argument
{{S}}. So all arguments are resolved properly and {{TypeInference.mergeBounds}} receives two
concrete class objects (in my case java.lang.Object and desired bound type from com.blabla
package). 


{code}org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate
components
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:728)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[21:org.apache.aries.util:1.1.1]
	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix$RefreshHelper.restart(Felix.java:5063)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix.refreshPackages(Felix.java:4253)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.FrameworkWiringImpl.run(FrameworkWiringImpl.java:188)[org.apache.felix.framework-5.6.1.jar:]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_102]
Caused by: java.lang.NullPointerException
	at org.apache.aries.blueprint.utils.generics.OwbTypeVariableImpl$OwbTypeVariableInvocationHandler.<init>(OwbTypeVariableImpl.java:61)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.utils.generics.OwbTypeVariableImpl.createTypeVariable(OwbTypeVariableImpl.java:43)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.utils.generics.TypeInference.mergeBounds(TypeInference.java:373)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.utils.generics.TypeInference.match(TypeInference.java:270)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.utils.generics.TypeInference.findMatching(TypeInference.java:233)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.utils.generics.TypeInference.findMatchingConstructors(TypeInference.java:125)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BeanRecipe.findMatchingConstructors(BeanRecipe.java:372)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:345)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:661)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:642)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_102]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)[12:org.apache.aries.blueprint.core:1.7.2.SNAPSHOT]
	... 20 more
{code}

> ComponentDefinitionException: Unable to find a matching constructor - cannot create beans
with generics
> -------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-960
>                 URL: https://issues.apache.org/jira/browse/ARIES-960
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-core-1.0.1
>         Environment: Karaf
>   Karaf version               2.3.0
>   Karaf home                  /home/ceefour/git/bippo-commerce5/karaf
>   Karaf base                  /home/ceefour/git/bippo-commerce5/karaf
>   OSGi Framework              org.apache.felix.framework - 4.0.3
> JVM
>   Java Virtual Machine        OpenJDK 64-Bit Server VM version 23.2-b09
>   Version                     1.7.0_07
>   Vendor                      Oracle Corporation
>   Uptime                      7 minutes
>   Total compile time          33.261 seconds
> Threads
>   Live threads                101
>   Daemon threads              86
>   Peak                        135
>   Total started               177
> Memory
>   Current heap size           228,508 kbytes
>   Maximum heap size           466,048 kbytes
>   Committed heap size         256,000 kbytes
>   Pending objects             0
>   Garbage collector           Name = 'PS Scavenge', Collections = 55, Time = 0.443 seconds
>   Garbage collector           Name = 'PS MarkSweep', Collections = 2, Time = 0.280 seconds
> Classes
>   Current classes loaded      11,212
>   Total classes loaded        11,213
>   Total classes unloaded      1
> Operating system
>   Name                        Linux version 3.2.0-32-generic
>   Architecture                amd64
>   Processors                  8
>            Reporter: Hendy Irawan
>            Assignee: Guillaume Nodet
>
> This is similar to #ARIES-834 and #ARIES-843, which was reported as fixed, but for some
reason, it's not fixed in my case.
> {code}
> 2012-11-07 18:30:50,648 | ERROR | rint Extender: 3 | BlueprintContainerImpl         
 | container.BlueprintContainerImpl  375 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Unable
to start blueprint container for bundle berbatik_security.xml
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to find a matching
constructor on class org.soluvas.web.login.SoluvasRealm for arguments [org.apache.aries.blueprint.container.BeanRecipe$UnwrapperedBeanHolder@5c2a497b,
org.apache.aries.blueprint.container.BeanRecipe$UnwrapperedBeanHolder@5c3e5982] when instanciating
bean shiroRealm
>         at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:336)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.0.1]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_07]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_07]
>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.0.1]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_07]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_07]
>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:646)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:353)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:252)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.0.1]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_07]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_07]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_07]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_07]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_07]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.7.0_07]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.7.0_07]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_07]
> {code}
> The constructor:
> {code}
> public SoluvasRealm(Supplier<SecurityCatalog> securityCatalogSupplier,
> 		SecurityRepository securityRepo) {
> 	super();
> 	this.securityCatalogSupplier = securityCatalogSupplier;
> 	this.securityRepo = securityRepo;
> 	setName(securityRepo.getDomainBase());
> 	CredentialsMatcher cm = new LdapBindCredentialsMatcher(securityRepo.getBindConfig(),
> 			securityRepo.getUsersRdn() + "," + securityRepo.getDomainBase());
> 	setCredentialsMatcher(cm);
> }
> {code}
> Relevant beans:
> {code}
> <bean id="securityPackage" class="org.soluvas.security.impl.SecurityPackageImpl" factory-method="init"
/>
> <bean id="aggregatingSecurityCatalogSupplier" class="org.soluvas.commons.AggregatingSupplier">
> 	<argument>
> 		<bean class="org.soluvas.security.impl.SecurityFactoryImpl" factory-method="init"
/>
> 	</argument>
> 	<argument>
> 		<bean factory-ref="securityPackage" factory-method="getSecurityCatalog" />
> 	</argument>
> 	<argument>
> 		<list />
> 	</argument>
> </bean>
> <service ref="aggregatingSecurityCatalogSupplier" auto-export="interfaces">
> 	<service-properties>
> 		<entry key="clientId" value="${clientId}" />
> 		<entry key="tenantEnv" value="${tenantEnv}" />
> 		<entry key="tenantId" value="${tenantId}" />
> 		<entry key="suppliedClass" value="org.soluvas.security.SecurityCatalog" />
> 		<entry key="layer" value="application" />
> 	</service-properties>
> </service>
> <bean id="securityRepo" class="org.soluvas.security.ldap.LdapSecurityRepository">
> 	<argument ref="ldapPool" />
> 	<argument value="${mallLdapBaseDn}" />
> 	<argument>
> 		<bean factory-ref="ldapConfigSupplier" factory-method="get" />
> 	</argument>
> 	<argument ref="rolePersonAssoc" />
> </bean>
> <service ref="securityRepo" auto-export="interfaces">
> 	<service-properties>
> 		<entry key="clientId" value="${clientId}" />
> 		<entry key="tenantId" value="${tenantId}" />
> 		<entry key="tenantEnv" value="${tenantEnv}" />
> 	</service-properties>
> </service>
> <bean id="shiroRealm" class="org.soluvas.web.login.SoluvasRealm" init-method="init">
> 	<argument ref="aggregatingSecurityCatalogSupplier" />
> 	<argument ref="securityRepo" />
> </bean>
> {code}
> Removing the generics in the constructor parameter makes it work:
> {code}
> Supplier<SecurityCatalog> securityCatalogSupplier
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message