• ElasticSearch无法启动


    安装了ElasticSearch5.5.1后,每次启动服务的时候,都是启动了一下就自动停止了。查看了一下EventViewer, 错误信息如下:

    Application: elasticsearch.exe

    Framework Version: v4.0.30319

    Description: The process was terminated due to an unhandled exception.

    Exception Info: Elastic.ProcessHosts.Process.StartupException

    at Elastic.ProcessHosts.Process.ProcessBase.HandleException(System.Exception)

    at System.Reactive.ObserverBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnError(System.Exception)

    at System.Reactive.Observer`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnError(System.Exception)

    at System.Reactive.Linq.ObservableImpl.AsObservable`1+_[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnError(System.Exception)

    at System.Reactive.AutoDetachObserver`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnErrorCore(System.Exception)

    at System.Reactive.ObserverBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnError(System.Exception)

    at Elastic.ProcessHosts.Process.ObservableProcess+<>c__DisplayClass22_0.<CreateProcessExitSubscription>b__0(System.Reactive.EventPattern`1<System.Object>)

    at System.Reactive.AnonymousSafeObserver`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnNext(System.__Canon)

    at System.EventHandler.Invoke(System.Object, System.EventArgs)

    at System.Diagnostics.Process.OnExited()

    at System.Diagnostics.Process.RaiseOnExited()

    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

    at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(System.Object, Boolean)

     

    看不出来什么。

    用命令行定位到ElasticSearch的安装目录,在命令行运行elasticsearch.exe, 错误信息如下:

    C:Program FilesElasticElasticsearchin>elasticsearch.exe

    java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearc

    h : Unsupported major.minor version 52.0

    at java.lang.ClassLoader.defineClass1(Native Method)

    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14

    2)

    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

     

     

    Exception in thread "main"

     

    看来是Java的版本不对。然后再在命令行运行elasticsearch.exe --debug-env, 结果如下:

    C:Program FilesElasticElasticsearchin>elasticsearch.exe --debug-env

    -------------

    Elasticsearch

    -------------

    ES_HOME (in order of precedence)

    - HomeDirectoryProcessVariable = C:Program FilesElasticElasticsearch

    - HomeDirectoryUserVariable =

    - HomeDirectoryMachineVariable = C:Program FilesElasticElasticsearch

    - From executable location = C:Program FilesElasticElasticsearch

    ES_CONFIG (in order of precedence)

    - ConfigDirectoryProcessVariable = C:ProgramDataElasticElasticsearchconfig

    - ConfigDirectoryUserVariable =

    - ConfigDirectoryMachineVariable = C:ProgramDataElasticElasticsearchconfig

    - Fallback to ES_HOME = C:Program FilesElasticElasticsearchconfig

     

    -------------

    Java

    -------------

    Java paths

    - current = C:Program FilesJavajdk1.7.0_67injava.exe

    Java Candidates (in order of precedence)

    - JavaHomeProcessVariable =

    - JavaHomeUserVariable =

    - JavaHomeMachineVariable =

    - JdkRegistry64 = C:Program FilesJavajdk1.7.0_67

    - JreRegistry64 = C:Program FilesJavajre1.8.0_144

    - JdkRegistry32 =

    - JreRegistry32 = C:Program Files (x86)Javajre1.8.0_111

    Java checks

    - Using32BitJava = False

    - JAVA_HOME as machine and user variable = False

     

    搜索了一下错误信息:

    org/elasticsearch/bootstrap/Elasticsearc h : Unsupported major.minor

     

    上面说的是ElasticSearch5.0至少需要Java8。 于是安装了Java8 Update.

    结果还是一样。难道需要重新安装ElasticSearch?

    于是卸载重新安装。重新安装了还是不行。

    仔细看了一下--debug-env的结果,发现jre虽然已经更新到了8,但是jdk还是7,那么就重新安装JDK8试试吧。

    JDK8的下载地址在这里:

    http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    安装后再运行--debug-env, 发现jdk和jre都是8了。

    C:Program FilesElasticElasticsearchin>elasticsearch.exe --debug-env

    -------------

    Elasticsearch

    -------------

    ES_HOME (in order of precedence)

    - HomeDirectoryProcessVariable = C:Program FilesElasticElasticsearch

    - HomeDirectoryUserVariable =

    - HomeDirectoryMachineVariable = C:Program FilesElasticElasticsearch

    - From executable location = C:Program FilesElasticElasticsearch

    ES_CONFIG (in order of precedence)

    - ConfigDirectoryProcessVariable = C:ProgramDataElasticElasticsearchconfig

    - ConfigDirectoryUserVariable =

    - ConfigDirectoryMachineVariable = C:ProgramDataElasticElasticsearchconfig

    - Fallback to ES_HOME = C:Program FilesElasticElasticsearchconfig

     

    -------------

    Java

    -------------

    Java paths

    - current = C:Program FilesJavajdk1.8.0_144injava.exe

    Java Candidates (in order of precedence)

    - JavaHomeProcessVariable =

    - JavaHomeUserVariable =

    - JavaHomeMachineVariable =

    - JdkRegistry64 = C:Program FilesJavajdk1.8.0_144

    - JreRegistry64 = C:Program FilesJavajre1.8.0_144

    - JdkRegistry32 =

    - JreRegistry32 = C:Program Files (x86)Javajre1.8.0_111

    Java checks

    - Using32BitJava = False

    - JAVA_HOME as machine and user variable = False

     

    再次启动ElasticSearch服务,成功了!不再自动停了。

  • 相关阅读:
    iOS 开发小记 (五)
    ReentrantLock API
    多线程之生产者消费者
    maven私服的项目使用配置
    maven仓库nexus安装配置
    thymeleaf自定义标签方言处理
    关于svn更新失败,clearup异常解决
    shiro+spring
    日常遇到的小问题
    springmvc控制器controller单例问题
  • 原文地址:https://www.cnblogs.com/time-is-life/p/7298380.html
Copyright © 2020-2023  润新知