【踩坑】SpringBoot启动失败 报错invoke Exception invoking method manageApp

报错日志为


01-Mar-2019 15:31:01.578 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
 java.lang.IllegalStateException: Error starting child
java.lang.IllegalStateException: Logback configuration error detected: 
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:716)
ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:22 - no applicable action for [contextName], current ElementPath  is [[configuration][appender][contextName]]
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1729)

......................

Caused by: java.lang.IllegalStateException: Logback configuration error detected: 
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:22 - no applicable action for [contextName], current ElementPath  is [[configuration][appender][contextName]]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:224)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:75)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)

最后通过排查是logback文件配置错误

从SpringMVC项目移植出的logback.xml文件到SpringBoot2.1.3项目中并不兼容


    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <!--子节点<contextName>:用来设置上下文名称,每个logger都关联到logger上下文,默认上下文名称为default。但可以使用<contextName>设置成其他名字,用于区分不同应用程序的记录。一旦设置,不能修改。-->
        <contextName>xxxxxxxx</contextName>
        <!-- encoders are by default assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

SpringBoot2.1.3中的logback1.2.3不支持该属性

将<contextName>属性删除解决问题

猜你喜欢

转载自blog.csdn.net/mmlik8878/article/details/88060740
今日推荐