查看原文
其他

渣渣菜鸡的 ElasticSearch 源码解析 —— 环境搭建

zhisheng zhisheng 2021-09-05


软件环境

1、Intellij Idea:2018.2版本

2、Elasticsearch 源码版本: 6.3.2

3、JDK:10.0.2

4、Gradle : 建议 4.5 及以上版本

5、Macbook Pro 2017

安装 ElasticSearch

去 https://www.elastic.co/downloads/past-releases 这里找到 ElasticSearch 6.3.2 版本,下载后然后解压就好了。(注意:这个版本需要和下面的源码版本一致)

下载源码

从 https://github.com/elastic/elasticsearch 上下载相应版本的源代码,这里建议用 git clone ,这样的话后面你可以随意切换到 ElasticSearch 的其他版本去。

1git clone git@github.com:elastic/elasticsearch.git

我们看下有哪些版本的:

1git tag

找到了目前源码版本最新的版本的稳定版为:v6.3.2

切换到该版本:

1git checkout v6.3.2

于是就可以切换到该稳定版本了。接下来不要直接导入到 IDEA/Eclipse 中。

编译

GitHub 这里已经有描述如何导入 IDEA/Eclipse 中:

1JDK 10 is required to build Elasticsearch. You must have a JDK 10 installation with the environment variable JAVA_HOME referencing the path to Java home for your JDK 10 installation. By default, tests use the same runtime as JAVA_HOME. However, since Elasticsearch, supports JDK 8 the build supports compiling with JDK 10 and testing on a JDK 8 runtime; to do this, set RUNTIME_JAVA_HOME pointing to the Java home of a JDK 8 installation. Note that this mechanism can be used to test against other JDKs as well, this is not only limited to JDK 8.
2
3Note: It is also required to have JAVA7_HOME, JAVA8_HOME and JAVA10_HOME available so that the tests can pass.
4
5Warningdo not use sdkman for Java installations which do not have proper jrunscript for jdk distributions.
6
7Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle using the wrapper via the gradlew script in the root of the repository.
8
9Configuring IDEs And Running Tests
10Eclipse users can automatically configure their IDE: ./gradlew eclipse then FileImport: Existing Projects into Workspace. Select the option Search for nested projects. Additionally you will want to ensure that Eclipse is using 2048of heap by modifying eclipse.ini accordingly to avoid GC overhead errors.
11
12IntelliJ users can automatically configure their IDE: ./gradlew idea then File->New Project From Existing Sources. Point to the root of the source directoryselect Import project from external model->Gradle, enable Use auto-import. In order to run tests directly from IDEA 2017.2 and above, it is required to disable the IDEA run launcher in order to avoid idea_rt.jar causing "jar hell". This can be achieved by adding the -Didea.no.launcher=true JVM option. Alternatively, idea.no.launcher=true can be set in the idea.properties file which can be accessed under Help > Edit Custom Properties (this will require a restart of IDEA). For IDEA 2017.3 and above, in addition to the JVM option, you will need to go to Run->Edit Configurations->...->Defaults->JUnit and verify that the Shorten command line setting is set to user-local default: none. You may also need to remove ant-javafx.jar from your classpath if that is reported as a source of jar hell.
13
14To run an instance of elasticsearch from the source code run ./gradlew run
15
16The Elasticsearch codebase makes heavy use of Java asserts and the test runner requires that assertions be enabled within the JVM. This can be accomplished by passing the flag -ea to the JVM on startup.
17
18For IntelliJ, go to Run->Edit Configurations...->Defaults->JUnit->VM options and input -ea.
19
20For Eclipse, go to Preferences->Java->Installed JREs and add -ea to VM Arguments.

上面说了下如何编译 Elasticsearch 和如何在 ide 中配置好环境。下面说下步骤吧:(这里我只是演示在 IDEA 中如何导入)

1、在我们下载的 Elasticsearch 根目录下执行命令:(执行已经写好的脚本 gradlew)

1./gradlew idea

请注意版本和我的一致,早的版本可能没有该执行脚本,需要执行 gradle idea 命令

最后结果如下:

2、导入 IDEA

idea 中 File -> New Project From Existing Sources 选择你下载的 Elasticsearch 根目录,然后点 open ,之后 Import project from external model -> Gradle , 选中 Use auto-import, 然后就可以了。

导入进去后,gradle 又会编译一遍,需要等一会,好了之后如下:

运行

打开 server 模块下的 Elasticsearch 类:org.elasticsearch.bootstrap.Elasticsearch,运行里面的 main 函数。

1、报错如下:

1ERROR: the system property [es.path.conf] must be set

我们在运行的配置 vm options 如下:(后面启动流程会写为什么会报这个错误)

1-Des.path.conf="/usr/local/elasticsearch-6.3.2/config"

2、再次运行,报错如下:

1Exception in thread "mainjava.lang.IllegalStateExceptionpath.home is not configured
2    at org.elasticsearch.env.Environment.<init>(Environment.java:103)
3    at org.elasticsearch.env.Environment.<init>(Environment.java:94)
4    at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:86)
5    at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:95)
6    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
7    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
8    at org.elasticsearch.cli.Command.main(Command.java:90)
9    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
10    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)

我们在运行的配置 vm options 如下:(后面启动流程会写为什么会报这个错误)

1-Des.path.home="/usr/local/elasticsearch-6.3.2"

3、再次运行,报错如下:

12018-08-01 09:38:03,974 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
2    at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
3    at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:371)
4    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1805)
5    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:318)
6    at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
7    at org.apache.logging.log4j.core.jmx.Server.register(Server.java:389)
8    at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:167)
9    at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
10    at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:556)
11    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
12    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:206)
13    at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:220)
14    at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:197)
15    at org.elasticsearch.common.logging.LogConfigurator.configureStatusLogger(LogConfigurator.java:171)
16    at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:140)
17    at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:119)
18    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:294)
19    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)
20    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127)
21    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
22    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
23    at org.elasticsearch.cli.Command.main(Command.java:90)
24    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
25    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)

我们在运行的配置 vm options 如下:

1-Dlog4j2.disable.jmx=true

4、如果你用的是 JDK 1.8 编译的应该还会报这个错误

1[2018-08-01T11:02:24,663][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
2org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: jar hell!
3class: jdk.packager.services.UserJvmOptionsService
4jar1: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/ant-javafx.jar
5jar2: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/packager.jar
6    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[main/:?]
7    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[main/:?]
8    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[main/:?]
9    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[main/:?]
10    at org.elasticsearch.cli.Command.main(Command.java:90) ~[main/:?]
11    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[main/:?]
12    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[main/:?]
13Caused by: java.lang.IllegalStateException: jar hell!
14class: jdk.packager.services.UserJvmOptionsService
15jar1: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/ant-javafx.jar
16jar2: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/packager.jar
17    at org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:273) ~[main/:?]
18    at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:190) ~[main/:?]
19    at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:86) ~[main/:?]
20    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:198) ~[main/:?]
21    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[main/:?]
22    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[main/:?]
23    ... 6 more
242018-08-01 11:02:24,713 Thread-2 ERROR No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.

有两个解决方法就是,

(1)、把源码中有关使用了 JarHell.checkJarHell 代码的地方全部注释掉就好了

(2)、换成 JDK 10 编译

两种方法我都试了是可行的,建议直接换第二种方案吧!

5、然后再启动的话,应该没问题了,出现下面日志:(网上很多人在这步就好了)

1[elasticsearch] Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2[elasticsearch] [2018-08-04T16:42:26,073][INFO ][o.e.n.Node               ] [node-0] initializing ...
3[elasticsearch] [2018-08-04T16:42:26,185][INFO ][o.e.e.NodeEnvironment    ] [node-0] using [1] data paths, mounts [[/ (/dev/disk1s1)]], net usable_space [109.3gb], net total_space [233.4gb], types [apfs]
4[elasticsearch] [2018-08-04T16:42:26,187][INFO ][o.e.e.NodeEnvironment    ] [node-0] heap size [494.9mb], compressed ordinary object pointers [true]
5[elasticsearch] [2018-08-04T16:42:26,190][INFO ][o.e.n.Node               ] [node-0] node name [node-0], node ID [o9SuMXP-R7uvJLtE3h37Rw]
6[elasticsearch] [2018-08-04T16:42:26,191][INFO ][o.e.n.Node               ] [node-0] version[6.3.2-SNAPSHOT], pid[61499], build[default/zip/053779d/2018-08-04T08:39:59.714654Z], OS[Mac OS X/10.13.5/x86_64], JVM["Oracle Corporation"/Java HotSpot(TM) 64-Bit Server VM/10.0.2/10.0.2+13]
7[elasticsearch] [2018-08-04T16:42:26,191][INFO ][o.e.n.Node               ] [node-0] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/var/folders/mb/3vpbvkkx13l2jmpt2kmmt0fr0000gn/T/elasticsearch.URRKTybG, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -ea, -esa, -Xms512m, -Xmx512m, -Des.path.home=/Users/zhisheng/IdeaProjects/github/elasticsearch/distribution/build/cluster/run node0/elasticsearch-6.3.2-SNAPSHOT, -Des.path.conf=/Users/zhisheng/IdeaProjects/github/elasticsearch/distribution/build/cluster/run node0/elasticsearch-6.3.2-SNAPSHOT/config, -Des.distribution.flavor=default, -Des.distribution.type=zip]
8[elasticsearch] [2018-08-04T16:42:26,191][WARN ][o.e.n.Node               ] [node-0] version [6.3.2-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production
9[elasticsearch] [2018-08-04T16:42:28,808][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [aggs-matrix-stats]
10[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [analysis-common]
11[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [ingest-common]
12[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-expression]
13[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-mustache]
14[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-painless]
15[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [mapper-extras]
16[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [parent-join]
17[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [percolator]
18[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [rank-eval]
19[elasticsearch] [2018-08-04T16:42:28,809][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [reindex]
20[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [repository-url]
21[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [transport-netty4]
22[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [tribe]
23[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-core]
24[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-deprecation]
25[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-graph]
26[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-logstash]
27[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-ml]
28[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-monitoring]
29[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-rollup]
30[elasticsearch] [2018-08-04T16:42:28,810][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-security]
31[elasticsearch] [2018-08-04T16:42:28,811][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-sql]
32[elasticsearch] [2018-08-04T16:42:28,811][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-upgrade]
33[elasticsearch] [2018-08-04T16:42:28,811][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [x-pack-watcher]
34[elasticsearch] [2018-08-04T16:42:28,811][INFO ][o.e.p.PluginsService     ] [node-0] no plugins loaded
35[elasticsearch] [2018-08-04T16:42:32,722][INFO ][o.e.x.s.a.s.FileRolesStore] [node-0] parsed [0] roles from file [/Users/zhisheng/IdeaProjects/github/elasticsearch/distribution/build/cluster/run node0/elasticsearch-6.3.2-SNAPSHOT/config/roles.yml]
36[elasticsearch] [2018-08-04T16:42:33,358][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/61517] [Main.cc@109] controller (64 bit): Version 6.3.2-SNAPSHOT (Build 903094f295d249) Copyright (c) 2018 Elasticsearch BV
37[elasticsearch] [2018-08-04T16:42:33,783][DEBUG][o.e.a.ActionModule       ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
38[elasticsearch] [2018-08-04T16:42:34,110][INFO ][o.e.d.DiscoveryModule    ] [node-0] using discovery type [zen]
39[elasticsearch] [2018-08-04T16:42:34,971][INFO ][o.e.n.Node               ] [node-0] initialized
40[elasticsearch] [2018-08-04T16:42:34,971][INFO ][o.e.n.Node               ] [node-0] starting ...
41[elasticsearch] [2018-08-04T16:42:35,217][INFO ][o.e.t.TransportService   ] [node-0] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
42[elasticsearch] [2018-08-04T16:42:38,291][INFO ][o.e.c.s.MasterService    ] [node-0] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {node-0}{o9SuMXP-R7uvJLtE3h37Rw}{xjoT1zvpRsm1ZDGLCab1sA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=17179869184, xpack.installed=true, testattr=test, ml.max_open_jobs=20, ml.enabled=true}
43[elasticsearch] [2018-08-04T16:42:38,295][INFO ][o.e.c.s.ClusterApplierService] [node-0] new_master {node-0}{o9SuMXP-R7uvJLtE3h37Rw}{xjoT1zvpRsm1ZDGLCab1sA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=17179869184, xpack.installed=true, testattr=test, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {node-0}{o9SuMXP-R7uvJLtE3h37Rw}{xjoT1zvpRsm1ZDGLCab1sA}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=17179869184, xpack.installed=true, testattr=test, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
44[elasticsearch] [2018-08-04T16:42:38,317][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node-0] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
45[elasticsearch] [2018-08-04T16:42:38,319][INFO ][o.e.n.Node               ] [node-0] started
46[elasticsearch] [2018-08-04T16:42:38,358][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [node-0] Failed to clear cache for realms [[]]
47[elasticsearch] [2018-08-04T16:42:38,413][INFO ][o.e.g.GatewayService     ] [node-0] recovered [0] indices into cluster_state
48[elasticsearch] [2018-08-04T16:42:38,597][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.watch-history-7] for index patterns [.watcher-history-7*]
49[elasticsearch] [2018-08-04T16:42:38,660][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.watches] for index patterns [.watches*]
50[elasticsearch] [2018-08-04T16:42:38,707][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.triggered_watches] for index patterns [.triggered_watches*]
51[elasticsearch] [2018-08-04T16:42:38,771][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
52[elasticsearch] [2018-08-04T16:42:38,836][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
53[elasticsearch] [2018-08-04T16:42:38,878][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
54[elasticsearch] [2018-08-04T16:42:38,926][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
55[elasticsearch] [2018-08-04T16:42:38,970][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
56[elasticsearch] [2018-08-04T16:42:39,055][INFO ][o.e.l.LicenseService     ] [node-0] license [79704513-d3c4-4535-8276-beeb146765de] mode [basic] - valid

6、但是我出现了下面这个问题,一直困扰着我呢,我是直接跳过去的。

1[2018-08-01T09:44:27,370][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [main], exiting
2java.lang.NoClassDefFoundError: org/elasticsearch/plugins/ExtendedPluginsClassLoader
3    at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:632) ~[main/:?]
4    at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:557) ~[main/:?]
5    at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:162) ~[main/:?]
6    at org.elasticsearch.node.Node.<init>(Node.java:311) ~[main/:?]
7    at org.elasticsearch.node.Node.<init>(Node.java:252) ~[main/:?]
8    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[main/:?]
9    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[main/:?]
10    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[main/:?]
11    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[main/:?]
12    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[main/:?]
13    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[main/:?]
14    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[main/:?]
15    at org.elasticsearch.cli.Command.main(Command.java:90) ~[main/:?]
16    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[main/:?]
17    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[main/:?]
18Caused by: java.lang.ClassNotFoundException: org.elasticsearch.plugins.ExtendedPluginsClassLoader
19    at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) ~[?:?]
20    at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) ~[?:?]
21    at java.lang.ClassLoader.loadClass(ClassLoader.java:499) ~[?:?]
22    ... 15 more

遇到的这个问题,我在 GitHub 求助信息如下:

https://github.com/elastic/elasticsearch/issues/30774

但是并没有解决我的问题,这里暂时先记录下来!我自己也跟了下源码,定位到错误信息是怎么产生的,但是没有解决方案!

总结

折腾的路上少不了各种错误烦扰你,学会解决问题!

关注我

zhisheng

转载请务必注明原创地址为:http://www.54tianzhisheng.cn/2018/08/25/es-code01/

相关文章

1、渣渣菜鸡为什么要看 ElasticSearch 源码?

2、Elasticsearch 系列文章(一):Elasticsearch 默认分词器和中分分词器之间的比较及使用方法

3、Elasticsearch 系列文章(二):全文搜索引擎 Elasticsearch 集群搭建入门教程

4、Elasticsearch 系列文章(三):ElasticSearch 集群监控

5、Elasticsearch 系列文章(四):ElasticSearch 单个节点监控

6、Elasticsearch 系列文章(五):ELK 实时日志分析平台环境搭建

: . Video Mini Program Like ,轻点两下取消赞 Wow ,轻点两下取消在看

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存