Tag Archives: Nacos startup error

[Solved] nacos Startup Error: Unable to start embedded Tomcat

Project scenario:

Nacos is prepared to be used as the configuration center. Version 1.3.1 (official recommended stable version – January 11, 2021)
MySQL version: version 5.7 (I heard that version 5.8 has changed greatly), otherwise nacos-mysql.sql file cannot be run
JDK version: 1.8.0_144 (the lower version not works)


Problem Description:

1. Run the spring cloud Alibaba Nacos source code in the local idea, and an error is reported: unable to start embedded Tomcat

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)
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)
	... 8 common frames omitted

Cause analysis:

Modified in the application.properties configuration file as below:

#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql

### Count of DB:
db.num=1

### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=root

Solution:

The solution of idea
The source code was downloaded locally and imported into idea, no error was reported or anything (although the import will prompt that various classes cannot be found or something) The startup class is in the console module, you need to modify the application.properties of this module, the modification method is the same as the modification method of the configuration file of nacos server, Nacos local source code build Start, if not a cluster start, you need to add -Dnacos.standalone=true in the start parameters.
1. Click Edit Configurations in the upper right corner

2. In the pop-up interface, enter -Dnacos.standalone=true in VM options, save it

[Solved] nacos Startup Error: Please set the JAVA_HOME variable in your environment

Nacos is registered as a service in centos7, but it cannot be started

report errors

Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!

reason

The java and javac of the installed JDK are not in the nacos startup script startup.sh (mine is under /opt/java/jdk1.8.0_333/)

terms of settlement

Add Java path to startup.sh

[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/java/jdk1.8.0_333

Restart the service successfully

[Solved] nacos Startup Error: java.io.IOException…

tip: here is a brief description of the project background:

Problem Scenario: Error on startup after installing nacos

Problem description

tip: describe the project here

Nacos startup error

Cause analysis:

Nacos defaults to cluster startup. Here is a startup error in the windows stand-alone environment

Solution:

Line 26 Modify set MODE="cluster" to MODE="standalone" and the problem is solved

[Solved] Nacos Startup Error: Error creating bean with name ‘authFilter‘

Nacos startup error: error creating bean with name ‘authfilter’:

Start failure reason

Turn the startup page to the top level, and you will find that Nacos is started in a cluster:

However, you just downloaded Nacos and did not make the cluster configuration of Nacos, so you need to start it in a stand-alone way.

Solution:

The first one: start the command line window under the bin directory of Nacos, and enter the command of single machine startup to start

startup.cmd -m stadalone

Second: modify the content of the startup.cmd script from set mode = "cluster" to set mode = "standalone", that is, change the cluster mode to stand-alone mode

Part of the contents of the original file of startup.cmd are as follows:

set MODE="cluster"
set FUNCTION_MODE="all"
set SERVER=nacos-server

After modification:

set MODE="standalone"
set FUNCTION_MODE="all"
set SERVER=nacos-server

ll”
set SERVER=nacos-server


Then double click startup.cmd to start, it is OK!

[Solved] Nacos Startup Error: [db-load-error]load jdbc.properties error

1. Check whether it is started in cluster mode

In the startup script startup.CMD, modify mode = “standalone”

2. Check database configuration

In the configuration file conf/application.Properties

It’s very annoying to remove the comments from the database configuration. Because Notepad is set to automatically wrap lines, I think the URL line is open and there are no comments, so I checked it for a long time. It’s really careless!

After these two steps are completed, it is basically OK. If another error occurs:

No DataSource set

The database is not connected!!!

To check the database connection and password, mine is mysql8, which is solved after authorizing the user.

3. Ultimate solution

If we can’t find any problems, we can also adjust the log level to debug or trace, so that the log is detailed enough and can basically locate the problems.

The log path is conf/Nacos-logback.xml

How to Solve Nacos startup error

Error 1:

Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerExcepti

Solution:
Open the startup file, and different operating systems open different files. Open startup.cmd on windows, open startup.sh for others, find set MODE, and change it to standalone mode.

Error 2:

Error creating bean with name ‘memoryMonitor’ defined in URL [jar: File:/D:/Nacos/nacos203/target/Nacos server. Jar!/boot-inf/lib/nacos-config-2.0.3. Jar
Solution:

Database connection If there is a problem, the correction method is as follows:
open the application.properties file in the nacos/conf/ folder , find the database connection address, pay attention to whether there is &serverTimezone=UTC after it, and add it if not.
db.url.0=jdbc:mysql: …/lamp_nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true &serverTimezone=UTC