0
更新:由於某些原因,我花了一點時間才意識到,但是我發現配置文件是特定於包PID的,並嘗試將相同的cfg文件加載到在兩個不同的捆綁包內的藍圖,我創造了一個競爭條件。確保只在目標包中使用cfg文件。Karaf v4.0.8:多個藍圖無法從相同的持久性ID加載配置
注:以上僅適用於藍圖捆綁包。如果你不依賴於OSGI ConfigAdmin服務來動態地保留這些包並且想要使用像Camel上下文那樣的cfg文件,那應該沒問題。
我有2個藍圖部署通過karaf 4.0.8'部署'文件夾。兩者都有以下公共部分:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.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 https://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder id="common" persistent-id="common" update-strategy="reload" placeholder-prefix="$(" placeholder-suffix=")"/>
<cm:property-placeholder id="sqlcfg" persistent-id="12345" update-strategy="reload" placeholder-prefix="$[" placeholder-suffix="]">
</cm:property-placeholder>
我想從'common'加載共同的配置。但是,當它們從'etc'文件夾共享相同的persistentId和屬性文件時,要部署的藍圖會繼續加載和卸載。 如果我讓它們從不同的文件加載 - 它一切正常。
社區的任何想法,爲什麼我有這種行爲? 在此先感謝。