• Nacos在双击startup.cmd启动时提示:Unable to start embedded Tomcat


    场景

    Nacos简介、下载与配置持久化到Mysql:

    https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/109356152

    在下载Nacos的zip包之后,双击bin下的startup.cmd之后提示:

    org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
            at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540)
            at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
            at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
            at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
            at com.alibaba.nacos.Nacos.main(Nacos.java:35)
            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:498)
            at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
            at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
            at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:466)
    Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
            at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125)
            at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86)
            at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:414)
            at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:174)
            at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181)
            at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154)
            ... 16 common frames omitted

    报错图片如下

    博客:
    https://blog.csdn.net/badao_liumang_qizhi
    关注公众号
    霸道的程序猿
    获取编程相关电子书、教程推送与免费下载。

    实现

    这是因为这里Nacos没有配置集群模式,而是使用的单机模式,所以编辑startup.cmd,

    将MODE修改为standalone

    默认MODE的值是"cluster"

    所以在走下面的逻辑时会走集群模式的逻辑

    if %MODE% == "standalone" (
        echo "nacos is starting with standalone"
       set"NACOS_OPTS=-Dnacos.standalone=true"
        set "NACOS_JVM_OPTS=-Xms512m -Xmx512m -Xmn256m"
    )

    rem if nacos startup mode is cluster
    if %MODE% == "cluster" (
        echo "nacos is starting with cluster"
       if %EMBEDDED_STORAGE% == "embedded" (
           set"NACOS_OPTS=-DembeddedStorage=true"
       )

        set "NACOS_JVM_OPTS=-server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%logsjava_heapdump.hprof -XX:-UseLargePages"
    )

    编辑之后,双击startup.cmd

    博客园: https://www.cnblogs.com/badaoliumangqizhi/ 关注公众号 霸道的程序猿 获取编程相关电子书、教程推送与免费下载。
  • 相关阅读:
    HDU 3564 Another LIS
    POJ 2104 K-th Number
    HYSBZ 1901 Dynamic Rankings
    HYSBZ 4321 queue2
    HYSBZ 3991 寻宝游戏
    工作中使用到的的MonogoDB查询语句记录。
    工作中使用到的的MySQL查询语句记录。
    python对文本文件的读写操作
    WRK的使用-lua脚本POST请求(静态数据)
    WRK的使用-lua脚本GET请求
  • 原文地址:https://www.cnblogs.com/badaoliumangqizhi/p/13896244.html
Copyright © 2020-2023  润新知