主题 : 关于jeecms前后端分离的疑问 |
级别: 贡士
|
64# 发表于:2019-10-22 11:22:51 IP:27.226.*.*
版主,启动失败每次都显示在jar包方式启动处理方法,这个地方要专门修改吗
@Configuration @PropertySource({ "classpath:config/spring.jpa.properties" }) @ImportResource({ "classpath:config/context*.xml","classpath:config/**/context*.xml" }) @EnableAutoConfiguration(exclude = { JmxAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class, FreeMarkerAutoConfiguration.class}) @Import({ ContextConfig.class, WebConfig.class, WebSocketConfig.class, ThreadPoolConfiguration.class }) @EnableTransactionManagement public class CmsFrontApplication extends SpringBootServletInitializer implements WebApplicationInitializer { static Logger logger = LoggerFactory.getLogger(CmsFrontApplication.class); /** * war方式启动的处理方法 */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return configureApplication(builder); } /** * jar方式启动的处理方法 * * @param args * String * @throws Exception * Exception */ public static void main(String[] args) throws Exception { configureApplication(new SpringApplicationBuilder()).run(args); } /** * war方式启动和jar方式启动共用的配置 * * @param builder * SpringApplicationBuilder */ private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) { return builder.sources(CmsFrontApplication.class) .listeners(new ApplicationListener<ApplicationEnvironmentPreparedEvent>() { // 在应用环境准备好后执行(Application.properties和PoropertySource已读取), // 此时BeanFactory还未准备好(Bean还未创建) @SuppressWarnings("unused") @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { ConfigurableEnvironment env = event.getEnvironment(); } }); } |
||
---|---|---|---|
级别: 贡士
|
69# 发表于:2019-10-22 12:45:30 IP:27.226.*.*
版主,很不好意思,按照要求,重新来一遍,在idea运行结果报错还是一样的,在麻烦你看看
2019-10-22 12:43:19*1 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. 2019-10-22 12:43:19*6 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-10-22 12:43:19.563 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137) at com.jeecms.front.CmsFrontApplication.main(CmsFrontApplication.java:64) Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:206) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ... 7 common frames omitted Process finished with exit code 1 |
||
---|---|---|---|
级别: 贡士
|
70# 发表于:2019-10-22 12:47:55 IP:27.226.*.*
主要错误在启动类
2019-10-22 12:43:19*1 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. 2019-10-22 12:43:19*6 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-10-22 12:43:19.563 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137) [i]at com.jeecms.front.CmsFrontApplication.main(CmsFrontApplication.java:64)[/i] Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:206) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ... 7 common frames omitted Process finished with exit code 1 |
||
---|---|---|---|