问题描述 :
springboot 程序运行出现以下情况
没有错误日志 返回运行结束 状态码 1 状态码为 1 的时候表示程序不是异常终止
连接到目标VM, 地址: ''127.0.0.1:4376',传输: '套接字'', 传输: '{1}'
2021-10-29 17:35:46 JRebel: Directory 'xxx\majorproject\target\classes' will be monitored for changes.
2021-10-29 17:35:47 JRebel:
2021-10-29 17:35:47 JRebel: A newer version '2021.4.0' is available for download
2021-10-29 17:35:47 JRebel: from https://jrebel.com/software/jrebel/download/
2021-10-29 17:35:47 JRebel:
2021-10-29 17:35:49 JRebel: Starting logging to file: C:\Users\jiannachun\.jrebel\jrebel.log
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: #############################################################
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: JRebel Agent 2021.2.2 (202105271234)
2021-10-29 17:35:49 JRebel: (c) Copyright 2007-2021 Perforce Software, Inc.
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: Over the last 30 days JRebel prevented
2021-10-29 17:35:49 JRebel: at least 74 redeploys/restarts saving you about 0.8 hours.
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: Over the last 365 days JRebel prevented
2021-10-29 17:35:49 JRebel: at least 2171 redeploys/restarts saving you about 24.1 hours.
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: License acquired from License Server: http://127.0.0.1:8888
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: Licensed to ilanyu.
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: You are using an offline license.
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel:
2021-10-29 17:35:49 JRebel: #############################################################
2021-10-29 17:35:49 JRebel:
Process finished with exit code 1
解决方案
步骤一: 在启动类中进行错误抓取
@SpringBootApplication
public class MajorDemolitionApplication {
public static void main(String[] args) {
try {
SpringApplication.run(MajorDemolitionApplication.class, args);
System.out.println("--- 项目 启动成功---" + "version1.0.0 => " + new Date());
} catch (Throwable e) {
//异常级别越大越好,我之前测试的时候,用的是Exception,但是没有日志。
e.printStackTrace();
}
}
}
步骤二:启动程序 观察控制台日志 此时会出现错误信息
2021-10-29 19:32:24 JRebel:
java.lang.IllegalStateException: Could not initialize Logback logging from classpath:logback-spring.xml
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:156)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:82)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:293)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:266)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:229)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:202)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.longshine.major.MajorProjectApplication.main(MajorProjectApplication.java:17)
Caused by: ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors.
at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:65)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:180)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:152)
... 18 more
Caused by: org.xml.sax.SAXParseException; systemId: file:/J:/majorproject/target/classes/logback-spring.xml; lineNumber: 191; columnNumber: 7; 元素类型 "configuration" 必须由匹配的结束标记 "</configuration>" 终止。
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:59)
... 23 more
---河北 重点项目 启动成功---version1.0.0 => Fri Oct 29 19:32:26 CST 2021
与目标VM断开连接, 地址为: ''127.0.0.1:11441',传输: '套接字'', 传输: '{1}'
Process finished with exit code 0
步骤三: 观察错误信息 发现 logback-spring.xml 文件配置有误 无法完整解析 (如下注释的时候不知道为什么缺失了一段注释)
修改处理即可 上次遇到这个问题是因为 在引入依赖的时候循环依赖导致的 然后没有做记录 这次记录下这样的问题处理方案