aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Łukasz Dywicki <l...@code-house.org>
Subject Custom namespace and dependant classes
Date Wed, 21 Aug 2013 11:19:36 GMT
Hi all,
I am trying to implement custom namespace handler which uses couple of pre-defined beans (blueprintContainer,
blueprintBundle). I have big troubles because bundles which uses my namespace must explicity
declare dependencies on org.osgi.service.blueprint.container and org.osgi.framework packages.
This stays in deep conflict with my understanding of custom namespace handlers because I wanted
to hide implementation details and all dependencies of implementation behind handler.

My XSD is following:
    <import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0" schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"/>

    <element name="resource-injector">
        <complexType>
            <complexContent>
                <extension base="beans:Tcomponent" />
            </complexContent>
        </complexType>
    </element>

The consumer bundles should use element <nsprefix:resource-injector id="blueprintResourceInjector"
/> to obtain instance of org.axonframework.saga.ResourceInjector (this is SPI interface
from axonframework).
Element parser is very simple:

    @Override
    public Metadata parse(Element element, ParserContext context) {
        MutableBeanMetadata metadata = createObjectOfClass(context, BlueprintResourceInjector.class.getName());
        metadata.setId(getId(element, context));

        metadata.addArgument(createRef(context, "blueprintBundle"), Bundle.class.getName(),
0);
        metadata.addArgument(createRef(context, "blueprintContainer"), BlueprintContainer.class.getName(),
1);

        return metadata;
    }

And result is unexpected:
Unable to start blueprint container for bundle com.axon.examples.simple-bus
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to load class org.osgi.framework.Bundle
from recipe BeanRecipe[name='blueprintResourceInjector']
	at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:195)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.loadType(BeanRecipe.java:255)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:273)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_13]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_13]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_13]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_13]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_13]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_13]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_13]
	at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_13]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_13]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_13]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_13]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_13]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_13]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_13]
	at java.lang.Thread.run(Thread.java:722)[:1.7.0_13]
Caused by: java.lang.ClassNotFoundException: org.osgi.framework.Bundle not found by com.axon.examples.simple-bus
[73]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_13]
	at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:419)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:410)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)[7:org.apache.aries.blueprint.core:1.1.0]
	... 38 more




Cheers,
Łukasz Dywicki
--
luke@code-house.org
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message