[ 
https://issues.apache.org/jira/browse/CAMEL-8194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Derek Abdine updated CAMEL-8194:
--------------------------------
    Description: 
{code}
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)
...
{code}

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:

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

  was:
{code}
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/MODULE/config/names.txt], and classpath
   at org.elasticsearch.env.Environment.resolveConfig(Environment.java:213)
   at 
org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:119)
...
{code}

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:

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


> Elasticsearch component fails in an OSGi environment due to missing names.txt
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-8194
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8194
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-elasticsearch
>    Affects Versions: 2.14.1
>            Reporter: Derek Abdine
>             Fix For: 2.15.0
>
>
> {code}
> 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)
> ...
> {code}
> 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:
> {code}
>             Settings settings = ImmutableSettings.settingsBuilder()
>                 ...
>                 .classLoader(Settings.class.getClassLoader());
>                 ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to