Trying to debug org.elasticsearch.bootstrap.Elasticsearch.java in Intellij


(Jonathan Aaron) #1

RESOLVED:
I found in the [testing documentation] (https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc)

That you can run gradle in the command line(intellij gradle plugin is not working for me, even on gradle 2.13) so I ran gradle run --debug-jvm Then I create a Remote in Intellij's Run/Debug Configurations and target port 8000 on localhost:

UPDATE but still Unresolved:
I'm getting around the path.home error by downloading elasticsearch and setting -Des.path.home to that directory. It's pretty hacky and I don't know how to get around it. What does everyone else set it too(es devs)?

I'm also adding all of the jars from that elasticsearch/lib/* to the classpath to get it to run. This is also hacky.

If you're an elasticsearch developer what does your configurations settings look like to run this project locally?

Original Post:
I would like to debug elasticsearch from Intellij. Spin up a node, put a breakpoint in, connect with kibana/java, add some data and see what happens. When I try to run Elasticsearch.java I get some errors which I've pasted below. How should I have my local environment setup and what env variables are needed? Thanks for any help.

Exception in thread "main" java.lang.IllegalStateException: path.home is not configured
	at org.elasticsearch.env.Environment.<init>(Environment.java:115)
	at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:90)
	at org.elasticsearch.bootstrap.Bootstrap.initialEnvironment(Bootstrap.java:230)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89)

and

2016-12-02 15:32:23,743 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:585)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1848)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:322)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
	at org.apache.logging.log4j.core.jmx.Server.register(Server.java:389)
	at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:167)
	at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:541)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:258)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:206)
	at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:220)
	at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:197)
	at org.elasticsearch.common.logging.LogConfigurator.configureStatusLogger(LogConfigurator.java:122)
	at org.elasticsearch.common.logging.LogConfigurator.configureWithoutConfig(LogConfigurator.java:65)
	at org.elasticsearch.cli.Command.main(Command.java:59)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89)

Edit: The AccessControlException has been solved with one of these environment variables:

-Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -server -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError

Still having the es.path.home issue.


(Alexander Reelsen) #2

Hey,

the Settings you are creating to need to have a path.home variable configured - either by using a settings class or by pointing to a specific config file.

You might want to check out the tests in Elasticsearch itself to see how a node is started in there. However it might also just be enough to increase the logging? Not exactly sure what you are trying to do, so hard to comment.

--Alex


(Jonathan Aaron) #3

Thanks for responding. I'm justing trying to start up the elasticsearch project in Intellij. I'm interested in how it get's it's requests and how it sends out those requests to other nodes. I'll check the test project and see if I can grab some settings from that. Have you ever started up Elasticsearch project in an IDE like IntelliJ or Eclipse?


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.