Running Elastic Search as a OSGI Service Bundle on Apache Felix

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