2016-11-09 7 views
1

Ich versuche ein eigenständiges OSGi-Framework auszuführen, um darin Blueprint-Bundles auszuführen, die Kamelrouten ausführen. Das OSGi-Framework ist Apache Felix, die Blueprint-Implementierung ist Apache Aries.Namespace "camel-blueprint" nicht in Blueprint-Deklaration gefunden (Widder in Felix)

Installed bundles

Jetzt habe ich ein Testpaket, das einen Entwurf Definition hat, die ein camelContext enthält, die wie folgt aussieht::

folgende Bundles werden die BundleContext des Rahmens geladen

<?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" 
    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.xsd"> 

    <camelContext xmlns="http://camel.apache.org/schema/blueprint"> 
     <route id="testRoute1"> 
      <from uri="timer:foo?period=5000" /> 
      <log message="Hello world!" /> 
     </route> 
    </camelContext> 

</blueprint> 

Obwohl alle Bundles geladen sind und die Anforderungen gelöst sind, enthält der Blueprint-Container das folgende Protokoll:

[de.hff.yosgi.test1.Test] : Installing test bundle 
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1 
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1. 
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1 
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1. 
[de.hff.yosgi.test1.Test] : Test bundle installed, starting 
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1 
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1. 
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1 
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1. 
[org.apache.aries.blueprint.container.BlueprintExtender] : Scanning bundle osgi-test1 for blueprint application 
[org.apache.aries.blueprint.container.BlueprintExtender] : Found blueprint application in bundle osgi-test1 with paths: [bundle://24.0:0/OSGI-INF/blueprint/blueprint.xml] 
[org.apache.aries.blueprint.container.BlueprintExtender] : Scheduling creation of blueprint bundle osgi-test1 asynchronously 
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state Unknown 
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=CREATING] for bundle osgi-test1 
[de.hff.yosgi.test1.Test] : Test bundle started 
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state WaitForNamespaceHandlers 
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Bundle osgi-test1 is waiting for namespace handlers [http://camel.apache.org/schema/blueprint] 
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint))]] for bundle osgi-test1 

Die wichtige Zeile hier ist die Waiting for namespace handlers: das Testpaket kann den Camel-Blueprint-Namespace nicht finden. Dieser Namespace sollte jedoch in dem installierten Kamel-Blueprint-Paket definiert werden.

Ohne die camelContext im Blueprint funktioniert alles (Blueprint Services geladen und initialisiert).

Hat jemand ähnliche Probleme mit diesem? Was verhindert, dass das Testpaket Zugriff auf die von camel-blueprint bereitgestellten Namespaces erhält?

+0

Sie müssen camel-Abhängigkeiten in das OSGi-Framework installieren. Wie Camel-Core, Kamel-Blaupause usw. –

+0

@ClausIbsen sehen Sie die 'Camel-Blueprint-2.18.0.jar' und die' Camel-Core-2.18.0.jar' ;-) Das Problem war, dass einige der Installierte JARs erzeugten Konflikte, ich werde demnächst eine Antwort hinzufügen. – maxdev

Antwort

0

Wir haben dieses Problem behoben, indem wir die Abhängigkeiten bereinigt haben. die folgenden sind nur erforderlich, tatsächlich:

Dependencies required to run an OSGi Felix standalone with Aries and Camel

, auch erfolgreich Kamel bekommen innerhalb Widder Blaupause zu laufen, ein zusätzlicher Parameter ist erforderlich, wenn der Rahmen instanziieren. Dadurch können die Bundles auf die Pakete sun.* zugreifen.

Iterator<FrameworkFactory> iterator = 
     ServiceLoader.load(FrameworkFactory.class).iterator(); 
FrameworkFactory factory = iterator.next(); 

Map<> configuration = new HashMap<String, String>(); 
configuration.put("org.osgi.framework.bootdelegation", "sun.*"); 
this.framework = factory.newFramework(configuration); 
Verwandte Themen