I have a jvm plugin with rest-action, which I wanted to upgrade to ES 2.0. But I was not able to debug in Eclipse anymore, how it does in former versions. The plugin simply does not get started.
I have a maven-project with ES 2.0 in the dependencies.
My run configuration has: org.elasticsearch.bootstrap.Elasticsearch as Main-Class start as argument
and as VM arguments:
So from my understanding, I have to write my own startup main-class instead of using the default org.elasticsearch.bootstrap.Elasticsearch to use plugin-types within the settings?
Is wonder this is really the only way? What has changed in 2.0.0, that debugging does not work then with the versions before? Sure, ElasticsearchF has gone, but is this the reason?
Or am I missing something else?
If you study the org.elasticsearch.bootstrap.* source code, you can see they are simply a wrapper around NodeBuilder.nodeBuilder().settings(settings).build() adding features that are orthogonal to ES plugins i.e. JNA, OS specific settings, CLI, logging etc.
Beside API and layout changes, ES 2.0 has added a lot more security settings which can easily get in your way while plugin testing. I recommend to just start a node for easy plugin unit testing.
So for unit testing, It is clear to me what you meant.
But what I wanted to reach is simply upstart Elastic WITH loaded plugin in debug-mode in eclipse, like I did for former versions with main-class from bootstrap.ElasticsearchF.
It's hard to give useful advise to the statement "The plugin simply does not get started". Maybe you can describe the steps you made more closely so that it can be reproduced.
HI Uladzimir
I start my plugin as your step,
But there are strange error log as below:
er]Exception in thread "main" java.lang.IllegalStateException: running tests but failed to invoke RandomizedContext#getRandom
Likely root cause: java.lang.IllegalStateException: No context information for thread: Thread[id=1, name=main, state=RUNNABLE, group=main]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:244)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.elasticsearch.common.Randomness.get(Randomness.java:101)
at org.elasticsearch.node.internal.InternalSettingsPreparer.randomNodeName(InternalSettingsPreparer.java:205)
at org.elasticsearch.node.internal.InternalSettingsPreparer.finalizeSettings(InternalSettingsPreparer.java:177)
at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:106)
at org.elasticsearch.common.cli.CliTool.(CliTool.java:107)
at org.elasticsearch.common.cli.CliTool.(CliTool.java:98)
at org.elasticsearch.bootstrap.BootstrapCLIParser.(BootstrapCLIParser.java:49)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:247)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
I'm not sure reviving a super old thread is the right way to get help for this, but I'll try.
You can see that error if you try and run the tests without the RandomizedRunner that we use for all of our tests. It looks like you are trying to run a main class though so I'm not sure what is up. Are your tests somehow leaking into your main classes?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.