TransportClient createInjector error

Hi All,

I am new to Elasticsearch and I am currently having this error when using ES2.

The error happens when Injector is being created during Node creation via NodeBuilder. The error is:
Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()

I am not sure what I am doing wrong with the settings.
Settings settings = NodeBuilder.nodeBuilder().settings()
.put("script.groovy.sandbox.enabled", true)
.put("script.inline", "on")
.put("script.indexed", "on")
.put("transport.tcp.port", 53568).build();
Node node = NodeBuilder.nodeBuilder().client(false).data(true).clusterName("test").settings(settings).build();

Please provide guidance on what I should be looking at in order to find the root cause.

Thank you very much.

Regards,
Andy

Not sure what you mean by ES2. 2.0.0-beta1? Can you provide the entire stack? I cannot reproduce the issue with 2.0.0-beta1. Could you give a bit more information about your project setup?

By the way, your example is missing path.home setting and you don't start the node after you build it.

Thanks for your response. Sorry about not providing enough information.

I am helping out with the elastic-gremlin project to upgrade it to use elastisearch 2.0.0-beta1 from 1.5.2.

The path.home was set inside the vm option for the junit test suite and I can see a new folder created for the cluster.

The actual stack trace are not related to elasticsearch at all. What happens is that while creating index in elastic-gremlin, it checks cluster health and see if the timeout is true then throw an IOException. The status is red and timeout is true.

The stack overflow error for the injector was found while debugging through the code around creating transport client. The client is still created but the injector is having this error with it. As I am new to elasticsearch so I'm not sure if this is the root cause to tests failing.

I did email the developer of elastic-gremlin for guidance and am waiting for a response. But just want to see if someone have seen this issue before and can spot the root cause.

Not sure how much it would help with the stack from elastic-gremlin:

    java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [org.elasticgremlin.structure.ElasticGraph]
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:74)
	at org.apache.tinkerpop.gremlin.GraphProvider.openTestGraph(GraphProvider.java:121)
	at org.apache.tinkerpop.gremlin.AbstractGremlinTest.setup(AbstractGremlinTest.java:83)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        ...
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.apache.tinkerpop.gremlin.AbstractGremlinSuite.runChild(AbstractGremlinSuite.java:190)
	at org.apache.tinkerpop.gremlin.AbstractGremlinSuite.runChild(AbstractGremlinSuite.java:48)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
	... 48 more
Caused by: java.lang.InstantiationException
	at org.elasticgremlin.structure.ElasticGraph.<init>(ElasticGraph.java:73)
	at org.elasticgremlin.structure.ElasticGraph.open(ElasticGraph.java:57)
	... 53 more
	Suppressed: java.io.IOException: RED status returned from cluster 'org.elasticsearch.client.support.AbstractClient$ClusterAdmin@6c538eb2', index 'standard'
		at org.elasticgremlin.queryhandler.elasticsearch.helpers.ElasticHelper.createIndex(ElasticHelper.java:54)
		at org.elasticgremlin.queryhandler.SimpleQueryHandler.init(SimpleQueryHandler.java:30)
		at org.elasticgremlin.structure.ElasticGraph.<init>(ElasticGraph.java:71)
		... 54 more

Ok, now when I delete the node folder the tests created I got a different stack trace.

NotSerializableExceptionWrapper[com/ning/compress/lzf/util/ChunkDecoderFactory]; nested: NotSerializableExceptionWrapper[com.ning.compress.lzf.util.ChunkDecoderFactory];
	at org.elasticsearch.common.compress.lzf.LZFCompressor.<init>(LZFCompressor.java:48)
	at org.elasticsearch.common.compress.CompressorFactory.<clinit>(CompressorFactory.java:44)
	at org.elasticsearch.common.compress.CompressedXContent.<init>(CompressedXContent.java:83)
	at org.elasticsearch.index.mapper.DocumentMapper.refreshSource(DocumentMapper.java:436)
	at org.elasticsearch.index.mapper.DocumentMapper.<init>(DocumentMapper.java:228)
	at org.elasticsearch.index.mapper.DocumentMapper$Builder.build(DocumentMapper.java:153)
	at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:250)
	at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:189)
	at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:371)
	at org.elasticsearch.index.mapper.MapperService.documentMapperWithAutoCreate(MapperService.java:398)
	at org.elasticsearch.index.shard.IndexShard.docMapper(IndexShard.java:1352)
	at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:460)
        ....
Caused by: NotSerializableExceptionWrapper[com.ning.compress.lzf.util.ChunkDecoderFactory]
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 21 more

java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.xcontent.smile.SmileXContent
	at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:124)
	at org.elasticsearch.action.support.ToXContentToBytes.buildAsBytes(ToXContentToBytes.java:62)
	at org.elasticsearch.action.deletebyquery.DeleteByQueryRequest.source(DeleteByQueryRequest.java:148)
	at org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder.execute(DeleteByQueryRequestBuilder.java:170)
	at org.elasticgremlin.queryhandler.elasticsearch.helpers.ElasticHelper.clearIndex(ElasticHelper.java:70)
	at org.elasticgremlin.ElasticGraphGraphProvider.clear(ElasticGraphGraphProvider.java:95)
	at org.apache.tinkerpop.gremlin.AbstractGremlinTest.tearDown(AbstractGremlinTest.java:132)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
         ...
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

NotSerializableExceptionWrapper[Could not initialize class org.elasticsearch.common.compress.CompressorFactory]
	at org.elasticsearch.common.compress.CompressedXContent.<init>(CompressedXContent.java:83)
	at org.elasticsearch.index.mapper.DocumentMapper.refreshSource(DocumentMapper.java:436)
	at org.elasticsearch.index.mapper.DocumentMapper.<init>(DocumentMapper.java:228)
	at org.elasticsearch.index.mapper.DocumentMapper$Builder.build(DocumentMapper.java:153)
	at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:250)
	at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:189)
	at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:371)

Any ideas? I am not sure where to start the investigation.

Can you try to add the dependency com.ning:compress-lzf to your classpath?

Example

<dependency>
	<groupId>com.ning</groupId>
	<artifactId>compress-lzf</artifactId>
	<version>1.0.3</version>
</dependency>

Hi Jorg,

Thanks for the response. It is indeed dependency issue but not related to the compressor.

However, your reply point me to the right direction. After I resolve the dependency things just worked.

Thanks a lot.

Regards,
Andy

Hi guys,

Andy, could you tell me what was the dependency issue you faced? I have the same exact problem with java.lang.StackOverflowError exception.

If anyone is looking for a solution to this, the dependency problem, at least for me, was an old version of jackson. I had this issue and updated jackson from 2.5.1 to 2.6.4 and the problem went away.

Hi Piotr,

It was sometime ago, I was trying to upgrade the code from elasticsearch 1.5 to 2.0 back then. What I did was I upgraded the jars and fixed the compile errors and everything can compile but I only identified the dependency issue when I try to build it. It was some dependency around jackson-dataformat-yaml and I need to exclude snakeyaml.

But that's specific to the elastic-gremlin project so I am not sure if that's related to your one.