Problem description
After the local source code compiles the nacos-1.0 master branch and configures mysql, it is successfully started as the service center and configuration center
but the gateway application starts with an error of 500 and an empty pointer exception.
failed to req API:/nacos/v1/ns/instance after all servers([127.0.0.1:8848])
It is said that the online query is caused by starting in cluster mode. It can be changed to stand-alone mode
however, the source code is not very familiar, and the configuration modification seems to have no effect.
Solutions
method 1
Temporarily, add the system configuration in the main method of the Nacos console project, and then use it normally. I use the embedded database here.
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos")
@ServletComponentScan
@EnableScheduling
public class Nacos {
public static void main(String[] args) {
System.setProperty("nacos.standalone", "true");
SpringApplication.run(Nacos.class, args);
}
}
It’s not clear what’s in the configuration file nacos.standalone=true The specific reason for not taking effect may be that the wrong documents have been put in and there is an opportunity to fill in the hole again
method 2
(both local uncompiled projects and compiled packages are valid)
Add startup parameters - Dnacos.standalone=true
method 3
If you are downloading the compiled Nacos. You can start
./bin by adding command directly/ startup.sh -m standalone
Similar Posts:
- [Solved] Nacos Startup Error: nacos can not start web server;
- [Solved] Using jdk11 to deploy Nacos under Linux, the startup error is: could not find or load main class
- [Two Solutions] non-static method xxx() cannot be referenced from a static context
- [Problems with the use of internal classes] No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclo
- Container Cannot Find bean, Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.
- Java error: No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Solution to the problem of Java program “resource leak: ‘SC’ is never closed” in vscode
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- .Net Core 5.0 Upload File sizes is limited via Swagger Api: error: request entity too large
- 【Java】No enclosing instance of type XXX is accessible. Must qualify the allocation with an enclos…