2016-12-15 6 views
2
私はJBossのヒューズを評価しています

(バージョン6.2.1.redhat-084使用)開始される前に、新しい機能の設定ファイルが読み込まれていない、と私は次の問題に遭遇しまし展開する場合:バンドルは

  • 私は私のプロジェクト
  • に多くの特徴を持っている各機能は、
  • 機能リポジトリファイルは、次のようになり、設定ファイルを持っています。

    <?xml version="1.0" encoding="UTF-8"?> 
    <features name="myservice-features" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"> 
        <feature name="myservice-common" version="${project.version}"> 
         <configfile finalname="etc/com.myorg.myservice_common.cfg" override="true">mvn:com.myorg/myservice-common/${project.version}/cfg/${build.environment}</configfile> 
         <bundle start-level="100" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-cache-api/1.0.0_1</bundle> 
         <bundle start-level="100" dependency="true">mvn:org.apache.camel/camel-velocity/${camel.version}</bundle> 
         <bundle start-level="110">mvn:com.myorg/myservice-common/${project.version}</bundle> 
        </feature> 
        <feature name="myservice-impl" version="${project.version}"> 
         <feature>myservice-common</feature> 
         <configfile finalname="etc/com.myorg.myservice.cfg" override="true">mvn:com.myorg/myservice-impl/${project.version}/cfg/${build.environment}</configfile> 
         <bundle start-level="200">mvn:com.hazelcast/hazelcast/${hazelcast.version}</bundle> 
         <bundle start-level="200">mvn:com.hazelcast/hazelcast-client/${hazelcast.version}</bundle> 
         <bundle start-level="220">mvn:com.myorg/myservice-impl/${project.version}</bundle> 
        </feature> 
    </features> 
    
    • サービスは、問題は、プロファイルの機能を展開するときに、コンフィギュレーション・ファイルは組織によってピックアップされていることである
    • ラクダのコンテキストでプロパティを初期化するために、対応するPIDを持つ青写真プロパティのプレースホルダを使用しています.apache.felix.fileinstallは、バンドルを解決しようとした後で、次の例外を実行します。

    2016-12-15 10:07:38,384 | ERROR | oyer-49-thread-1 | BlueprintContainerImpl   | 23 - org.apache.aries.blueprint.core - 1.4.4 | Unable to start blueprint container for bundle otc-trade-service-impl/1.0.0.SNAPSHOT 
    org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean .camelBlueprint.factory.myservice-impl-context 
         at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)[23:org.apache.aries.blueprint.core:1.4.4] 
    ... 
    Caused by: java.lang.IllegalArgumentException: Property placeholder key: xxxxx not found 
         at org.apache.camel.blueprint.BlueprintPropertiesParser.parseProperty(BlueprintPropertiesParser.java:164) 
         at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doGetPropertyValue(DefaultPropertiesParser.java:306)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] 
         at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:246)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] 
         at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:154)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] 
         at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:113)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] 
         at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:97)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] 
         at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:62) 
         at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:178) 
         at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:129) 
         at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1956) 
         at org.apache.camel.model.ProcessorDefinitionHelper.resolvePropertyPlaceholders(ProcessorDefinitionHelper.java:734) 
         at org.apache.camel.model.RouteDefinitionHelper.initRouteInputs(RouteDefinitionHelper.java:379) 
         ... 47 more 
    
    • これはhttps://issues.jboss.org/browse/ENTESB-593を発行するために似ています。しかし、唯一の$ {karaf.base}/etcフォルダにコピーされたコンフィギュレーションファイルを持つが、実際のバンドルに

    を開始する前に、トリガーとkarafの構成マネージャーに同期していない関係という問題に「修正」のように見えます私はこの問題でちょっと固まっています。私のバンドルには 'start = "false"'を設定し、プロファイル展開後にすべてのcamelコンテキストバンドルを手動で起動することはできますが、より最適なソリューションがあるかどうかを知りたいと思います。

  • +0

    JBoss Fuse 6.3.0を試しましたか? –

    答えて

    0

    私は今のところ、以下のハックの回避策をアップ作ってみた:org.osgi.compendium:5.0.0とorg.osgi:org.osgi

    • はorg.osgiの依存関係を追加します。コア:

    :5.0.0

  • は、次のBundleActivatorクラスを作成します。
    package com.myorg.common; 
    
    import org.osgi.framework.Bundle; 
    import org.osgi.framework.BundleActivator; 
    import org.osgi.framework.BundleContext; 
    import org.osgi.framework.ServiceRegistration; 
    import org.osgi.service.cm.Configuration; 
    import org.osgi.service.cm.ConfigurationEvent; 
    import org.slf4j.Logger; 
    import org.slf4j.LoggerFactory; 
    
    import java.util.Dictionary; 
    
    public class ConfigurationActivator implements BundleActivator { 
    
        public static final String BUNDLE_CONFIGURATION_WATCH = "bundle.configuration.watch"; 
        public static final String BUNDLE_SYMBOLIC_NAME = "bundle.symbolic.name"; 
    
        private static final Logger LOG = LoggerFactory.getLogger(ConfigurationActivator.class); 
        private ServiceRegistration<org.osgi.service.cm.ConfigurationListener> listenerReg; 
    
        public void start(BundleContext context) throws Exception { 
         LOG.debug("Bundle " + context.getBundle().getSymbolicName() + " starting"); 
         listenerReg = context.registerService(org.osgi.service.cm.ConfigurationListener.class, 
           new ConfigurationListener(context), null); 
        } 
    
        public void stop(BundleContext context) throws Exception { 
         LOG.debug("Bundle " + context.getBundle().getSymbolicName() + " stopping"); 
         if (listenerReg != null) { 
          listenerReg.unregister(); 
         } 
        } 
    
        public class ConfigurationListener implements org.osgi.service.cm.ConfigurationListener { 
         private BundleContext bundleContext; 
    
         public ConfigurationListener(BundleContext bundleContext) { 
          this.bundleContext = bundleContext; 
         } 
    
         public void configurationEvent(ConfigurationEvent configurationEvent) { 
          try { 
           if (configurationEvent.getType() == ConfigurationEvent.CM_UPDATED) { 
            LOG.debug("Configuration update event: " + configurationEvent.getPid()); 
            Bundle bundle = bundleContext.getBundle(); 
            LOG.trace("Bundle " + bundle.getSymbolicName() + " state: " + bundle.getState()); 
            try { 
             Configuration configuration = bundleContext.getService(configurationEvent.getReference()).getConfiguration(configurationEvent.getPid()); 
             if (configuration != null) { 
              Dictionary<String, Object> properties = configuration.getProperties(); 
              if (properties != null) { 
               if (Boolean.TRUE.toString().equals(properties.get(BUNDLE_CONFIGURATION_WATCH)) 
                 && bundle.getSymbolicName().equals(properties.get(BUNDLE_SYMBOLIC_NAME))) { 
                LOG.info("Updating bundle " + bundle.getSymbolicName() + " due to configuration change"); 
                bundle.update(); 
               } 
              } 
             } 
            } catch (Exception e) { 
             throw new RuntimeException(e); 
            } 
           } 
          } catch (IllegalStateException se) { 
           LOG.warn("Bundle context has been invalidated"); 
          } 
         } 
        } 
    } 
    
    • は、マニフェストバンドル
    • に、このバンドル・アクティベーターを追加するには、設定ファイルに次のプロパティを追加します。

      bundle.configuration.watch=true 
      bundle.symbolic.name=<bundle-name> 
      
    • は機能を展開します。

      1. 追加の構成プロパティ
      2. :バンドルがすでに開始しようとした後に設定が変更された場合、バンドルは

    に更新されますこれはまだによる二つの理由に私には無粋な感じ元の問題では、展開中にログに混乱しているエラーメッセージが表示されることがあります。

  • 誰かが良い答えを提案できますか?

    関連する問題