Is this no direct usage?
[XML HEADERS]
<bean
class="de.kisters.project.domain.impl.session.repository.RepositoryFactory"
init-method="activate" destroy-method="deactivate">
<property name="containerManager" ref="containerManagerId"/>
</bean>
[EOF]
I just pass the bean ID as the ref-value.
--------------------------------------------------------------------------------------------------------------------------------------------
Andy Schmidt - KISTERS AG - Pascalstraße 8+10 - 52076 Aachen - Germany
Handelsregister Aachen, HRB-Nr. 7838 | Vorstand: Klaus Kisters, Hanns Kisters |
Aufsichtsratsvorsitzender: Dr. Thomas Klevers
Phone: +49 2408 9385 -449 | Fax: +49 2408 9385 -555 | E-Mail:
[email protected] | WWW: http://www.kisters.de
--------------------------------------------------------------------------------------------------------------------------------------------
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorised
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
From: Jean-Baptiste Onofré <[email protected]>
To: [email protected],
Date: 16.12.2014 10:47
Subject: Re: Unable to convert value
org.apache.aries.blueprint.container.ServiceRecipe$ServiceRegistrationProxy
The problem is the usage of reference. Just use bean directly.
Sent from my Samsung Galaxy smartphone.
-------- Original message --------
From: Andy Schmidt <[email protected]>
Date:16/12/2014 09:48 (GMT+01:00)
To: [email protected]
Cc:
Subject: Re: Unable to convert value
org.apache.aries.blueprint.container.ServiceRecipe$ServiceRegistrationProxy
Hi Freeman Fang,
thank you for your response.
How would you do it? What do you mean with "refer to the bean directly"?
It is a service and still has to be a service because another bundle also
uses it.
So how do I get the one service instance that is registered in the
blueprint container?
To the "chicken-egg" problem:
I saw in the IBM tutorial that it is possible to use the blueprint "ref"
property to refer to a blueprint bean of the same bundle.
http://www-01.ibm.com/support/knowledgecenter/SSCKBL_8.5.5/com.ibm.websphere.osgi.nd.doc/ae/ca_blueprint_references.html?lang=en
If I understood it right, this is possible by only using the ref-property
with the desired bean ID and NOT including the reference tag:
<reference id="containerManagerRef"
interface="de.kisters.project.domain.api.session.container.IContainerManager"
availability="mandatory" />
Thank you and regards
Tim
--------------------------------------------------------------------------------------------------------------------------------------------
Andy Schmidt - KISTERS AG - Pascalstraße 8+10 - 52076 Aachen - Germany
Handelsregister Aachen, HRB-Nr. 7838 | Vorstand: Klaus Kisters, Hanns
Kisters | Aufsichtsratsvorsitzender: Dr. Thomas Klevers
Phone: +49 2408 9385 -449 | Fax: +49 2408 9385 -555 | E-Mail:
[email protected] | WWW: http://www.kisters.de
--------------------------------------------------------------------------------------------------------------------------------------------
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
From: Freeman Fang <[email protected]>
To: [email protected],
Date: 16.12.2014 07:09
Subject: Re: Unable to convert value
org.apache.aries.blueprint.container.ServiceRecipe$ServiceRegistrationProxy
Hi,
If they are in the same bundle context, why not refer the
de.kisters.project.domain.impl.session.container.ContainerManager bean
directly but not the service.
Your way run into the chicken-egg problem, that said, your bundle depend
on a service provided by the bundle itself.
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-12-15, at 下午11:15, Andy Schmidt wrote:
> Hey,
>
> we are trying to register a couple of blueprint services using Karaf
> 3.0.2.
>
> Two of those services (lets call them "service A" and "service B") are
> located in one and the same bundle.
> Service A has a reference to service B.
>
> We are getting the following exception:
>
> org.osgi.service.blueprint.container.ComponentDefinitionException: Error
> setting property: PropertyDescriptor <name: containerManager, getter:
> null, setter: [class
>
de.kisters.kimatman.domain.impl.session.repository.RepositoryFactory.setContainerManager(interface
> de.kisters.kimatman.domain.api.session.container.IContainerManager)] at
>
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)
> at
>
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)
> at
>
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)
> at
>
org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)
> at
>
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
> at
>
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at
> java.util.concurrent.FutureTask.run(FutureTask.java:166) at
>
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
> at
>
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
> at
>
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
> at
>
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:681)
> at
>
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:378)
> at
>
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
> at
>
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)
> at
>
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:245)
> at
>
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:235)
> at
>
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
> at
>
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
> at
>
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
> at
>
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
> at
>
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
> at
>
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
> at
>
org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)
> at
>
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403) at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2092) at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955) at
>
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245)
> at
>
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217)
> at
>
org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509)
> at
>
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)
> at
>
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)
>
>
> Caused by: java.lang.Exception: Unable to convert value
>
org.apache.aries.blueprint.container.ServiceRecipe$ServiceRegistrationProxy@20766905
> to type
de.kisters.kimatman.domain.api.session.container.IContainerManager
> at
>
org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)
> at
>
org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)
> at
>
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)
> at
>
org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)
> at
>
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)
> at
>
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)
> ... 32 more
>
> Our blueprint files look like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="
> http://aries.apache.org/xmlns/jpa/v1.1.0"
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
> xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint-2.8.0.xsd
> http://aries.apache.org/xmlns/transactions/v1.0.0
> http://aries.apache.org/schemas/transaction/transactionv10.xsd
> http://aries.apache.org/xmlns/jpa/v1.1.0
> http://aries.apache.org/schemas/jpa/jpa_110.xsd">
>
> <service id="containerManagerId"
>
>
interface="de.kisters.project.domain.api.session.container.IContainerManager">
> <bean
>
class="de.kisters.project.domain.impl.session.container.ContainerManager"
> />
> </service>
>
>
> </blueprint>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="
> http://aries.apache.org/xmlns/jpa/v1.1.0"
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
> xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint-2.8.0.xsd
> http://aries.apache.org/xmlns/transactions/v1.0.0
> http://aries.apache.org/schemas/transaction/transactionv10.xsd
> http://aries.apache.org/xmlns/jpa/v1.1.0
> http://aries.apache.org/schemas/jpa/jpa_110.xsd">
> <bean
>
>
class="de.kisters.project.domain.impl.session.repository.RepositoryFactory"
> init-method="activate" destroy-method="deactivate">
> <property name="containerManager"
ref="containerManagerId"
> />
> </bean>
>
> </blueprint>
>
> Do you have any hints how to solve the problem?
>
> Best regards,
>
> Andy & Tim
>
--------------------------------------------------------------------------------------------------------------------------------------------
> Andy Schmidt - KISTERS AG - Pascalstraße 8+10 - 52076 Aachen - Germany
> Handelsregister Aachen, HRB-Nr. 7838 | Vorstand: Klaus Kisters, Hanns
Kisters | Aufsichtsratsvorsitzender: Dr. Thomas Klevers
> Phone: +49 2408 9385 -449 | Fax: +49 2408 9385 -555 | E-Mail:
[email protected] | WWW: http://www.kisters.de
>
--------------------------------------------------------------------------------------------------------------------------------------------
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
> This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.