项目

一般

简介

V9启动报org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: java.lang.Exception: failed to start apusic server services

由 lv pengqin 在 将近 3 年 之前添加

问题描述:报错如下

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: java.lang.Exception: failed to start apusic server services
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at com.kl.AdminApplication.main(AdminApplication.java:37)
    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:107)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.RuntimeException: java.lang.Exception: failed to start apusic server services
    at com.apusic.springframework.boot.context.embedded.ApusicEmbeddedServletContainerFactory.getWebServer(ApusicEmbeddedServletContainerFactory.java:95)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:158)
    ... 17 common frames omitted
Caused by: java.lang.Exception: failed to start apusic server services
    at com.apusic.server.J2EEServer.startEmbedded(J2EEServer.java:347)
    at com.apusic.springframework.boot.context.embedded.ApusicEmbeddedServletContainerFactory.getWebServer(ApusicEmbeddedServletContainerFactory.java:61)
    ... 19 common frames omitted
 

排查过程:查看apusic.conf发现最大空闲线程数值比最大线程数值要大

解决方法:将MaxThreads调整成与压测时的并发(1000)一致即可

参数设置建议:如果服务器总数为100,一般按最大并发数来就好,也就是100。如果是io耗时比较高的像sql查询比较久可以设置2倍,也就是200。起不来主要是线程池设置有问题,空闲比最大都大,线程池初始化不了,如果最大改成100,空闲最好都改成25/50这样。