Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8194

Elasticsearch component fails in an OSGi environment due to missing names.txt

    XMLWordPrintableJSON

Details

    • Novice

    Description

      2014-12-29 22:25:12,667 | ERROR | FelixStartLevel  | BlueprintCamelContext            | 8 - org.apache.camel.camel-blueprint - 2.14.0 | Error occurred during starting Camel: CamelContext(elasticSearchProducerCamelContext) due Failed to create route log-event-sink-elasticsearch at: >>> Aggregate[true -> [To[log:xxx?level=INFO&groupInterval=2000], To[elasticsearch://elasticsearch?ip=127.0.0.1&port=9300]]] <<< in route: Route(log-event-sink-elasticsearch)[[From[vm:log-event-elast... because of Failed to resolve endpoint: elasticsearch://elasticsearch?ip=127.0.0.1&port=9300 due to: Failed to resolve config path [names.txt], tried file path [names.txt], path file [xxx/config/names.txt], and classpath
      org.apache.camel.FailedToCreateRouteException: Failed to create route log-event-sink-elasticsearch at: >>> Aggregate[true -> [To[log:xxx?level=INFO&groupInterval=2000], To[elasticsearch://elasticsearch?ip=127.0.0.1&port=9300]]] <<< in route: Route(log-event-sink-elasticsearch)[[From[vm:log-event-elast... because of Failed to resolve endpoint: elasticsearch://elasticsearch?ip=127.0.0.1&port=9300 due to: Failed to resolve config path [names.txt], tried file path [names.txt], path file [xxx/config/names.txt], and classpath
         at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945)
         at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187)
      ...
      Caused by: org.elasticsearch.env.FailedToResolveConfigException: Failed to resolve config path [names.txt], tried file path [names.txt], path file [xxx/config/names.txt], and classpath
         at org.elasticsearch.env.Environment.resolveConfig(Environment.java:213)
         at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:119)
      ...
      

      This can be fixed by adding a one-liner to explicitly set the classloader on the elasticsearch Settings class to the classloader of Settings.class:

                  Settings settings = ImmutableSettings.settingsBuilder()
                      ...
                      .classLoader(Settings.class.getClassLoader());
                      ...
      

      Attachments

        Issue Links

          Activity

            People

              njiang Willem Jiang
              slush Derek Abdine
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: