2016-11-09 1 views
1

낙타 경로를 실행하는 독립 실행 형 OSGi 프레임 워크를 실행하여 청사진 묶음을 실행하려고합니다. OSGi 프레임 워크는 Apache Felix이고, 청사진 구현은 Apache Aries입니다. "camel-blueprint"네임 스페이스가 청사진 선언에 없습니다. (Felix 내의 Aries)

다음 번들

는 프레임 워크의 BundleContext에로드됩니다

Installed bundles

가 지금은 다음과 같이 보이는 camelContext을 포함하는 청사진 정의가 테스트 번들이 있습니다

<?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> 

모든 번들이로드되고 요구 사항이 해결되었지만 청사진 컨테이너는 다음 로그를 제공합니다.

[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 

여기서 중요한 라인은 Waiting for namespace handlers입니다. 테스트 번들은 낙타 청사진 네임 스페이스를 찾을 수 없습니다. 그러나이 네임 스페이스는 설치된 낙타 - 청사진 번들에 정의되어야합니다.

청사진에camelContext이 없으면 모든 것이 작동합니다 (청사진 서비스가로드되고 초기화됩니다).

아무도 비슷한 문제가 있었습니까? 테스트 번들이 camel-blueprint 제공된 네임 스페이스에 액세스하지 못하게하는 것은 무엇입니까?

+0

OSGi 프레임 워크에 낙타 의존성을 설치해야합니다. camel-core, camel-blueprint 등. –

+0

@ClausIbsen은'camel-blueprint-2.18.0.jar' 및'camel-core-2.18.0.jar'를 참조하십시오 .- 문제는 설치된 JAR이 충돌을 일으켰습니다. 곧 답변을 추가하겠습니다. – maxdev

답변

0

종속성을 정리하여이 문제를 해결했습니다. 만 실제로 다음 요구 사항을 충족해야

또한

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

가 성공적으로 낙타 양자리 청사진 내에서 실행하기 위해 얻을 수있는 프레임 워크를 인스턴스화 할 때, 추가 매개 변수가 필요합니다. 이를 통해 번들은 sun.* 패키지에 액세스 할 수 있습니다.

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);