# Running Elastic Search as a OSGI Service Bundle on Apache Felix

**URL:** <https://discuss.elastic.co/t/running-elastic-search-as-a-osgi-service-bundle-on-apache-felix/9505>\
**Category:** Elasticsearch\
**Created:** [October 31, 2012, 7:48am UTC](https://discuss.elastic.co/t/running-elastic-search-as-a-osgi-service-bundle-on-apache-felix/9505 "2012-10-31T07:48:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Prasad](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@Ashish\_Prasad](https://discuss.elastic.co/u/Ashish_Prasad)\
**Post date:** [October 31, 2012, 7:48am UTC](https://discuss.elastic.co/t/running-elastic-search-as-a-osgi-service-bundle-on-apache-felix/9505/1 "2012-10-31T07:48:34Z")

</div>

Hi,

I am trying to create my custom service bundle which uses elastic search in the backend.

I'm using the following maven dependencies:  
_elasticsearch:0.19.11 [compile]_

and the following elastic search dependencies as mentioned in its corresponding pom:  
_lucene-core : 3.6.1 [compile]  
lucene-analyzers : 3.6.1 [compile]  
lucene-queries : 3.6.1 [compile]  
lucene-memory : 3.6.1 [compile]  
lucene-highlighter : 3.6.1 [compile]  
log4j : 1.2.17 [compile]  
slf4j-api : 1.6.2 [compile]  
jna : 3.3..0 [compile]  
sigar : 1.6.4 [compile]  
snappy-java : 1.0.4.1 [compile]  
testng : 6.8 [test]  
hamcrest-all : 1.3 [test]_

I am also embedding the necessary dependencies in my bundle by including the following in my service pom:

_maven-dependency-plugin_  
   
   
_copy-dependencies-deploy  
package_  
   
_provided  
false  
false_  
   
   
_copy-dependencies_

and,

_org.apache.felix  
maven-bundle-plugin_  
   
   
_bundle-manifest  
process-classes_  
   
_manifest_  
   
   
   
   
   
_${project.artifactId}  
${project.version}  
org.service.ElasticSearchServiceActivator  
org.service._  
   
_\*;scope=compile;inline=false  
true_

In my service bundle activator start method when I call the following to start Elastic Search in the back end:

_NodeBuilder nodeBuilder = nodeBuilder().clusterName("elasticsearch").client(false);  
nodeBuilder.settings().put("index.number\_of\_shards", 5);  
 **Node node = nodeBuilder.node();**  
Client client = node.client();_

Following Exception Occur:

ERROR-Node1 \> org.elasticsearch.common.inject.CreationException: Guice creation errors:  
ERROR-Node1 \>  
ERROR-Node1 \> 1) Error injecting constructor, java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue  
ERROR-Node1 \> at org.elasticsearch.action.search.type.TransportSearchCache.(Unknown Source)  
ERROR-Node1 \> while locating org.elasticsearch.action.search.type.TransportSearchCache  
ERROR-Node1 \> for parameter 3 at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction.(Unknown Source)  
ERROR-Node1 \> while locating org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction  
ERROR-Node1 \> for parameter 4 at org.elasticsearch.action.search.TransportSearchAction.(Unknown Source)  
ERROR-Node1 \> while locating org.elasticsearch.action.search.TransportSearchAction  
ERROR-Node1 \> for parameter 2 at org.elasticsearch.action.mlt.TransportMoreLikeThisAction.(Unknown Source)  
ERROR-Node1 \> while locating org.elasticsearch.action.mlt.TransportMoreLikeThisAction  
ERROR-Node1 \> Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue  
ERROR-Node1 \> at org.elasticsearch.common.util.concurrent.ConcurrentCollections.newQueue(ConcurrentCollections.java:60)  
ERROR-Node1 \> at org.elasticsearch.action.search.type.TransportSearchCache.(TransportSearchCache.java:38)  
ERROR-Node1 \> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
ERROR-Node1 \> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)  
ERROR-Node1 \> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)  
ERROR-Node1 \> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)  
ERROR-Node1 \> at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:819)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:819)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:819)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:819)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:56)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:812)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)  
ERROR-Node1 \> at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)  
ERROR-Node1 \> at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)  
ERROR-Node1 \> at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)  
ERROR-Node1 \> at org.elasticsearch.node.internal.InternalNode.(InternalNode.java:155)  
ERROR-Node1 \> at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)  
ERROR-Node1 \> at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)

Kindly, provide solution to my problem.  
Thanks in advance.

_Ashish Prasad_

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:06am UTC](https://discuss.elastic.co/t/running-elastic-search-as-a-osgi-service-bundle-on-apache-felix/9505/2 "2017-07-06T03:06:44Z")

</div>


