1. 程式人生 > 其它 >"Process finished with exit code 1" 程序結束

"Process finished with exit code 1" 程序結束



問題描述 :
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檔案配置有誤無法完整解析 (如下注釋的時候不知道為什麼缺失了一段註釋)


修改處理即可 上次遇到這個問題是因為在引入依賴的時候迴圈依賴導致的 然後沒有做記錄 這次記錄下這樣的問題處理方案
白茶清歡無別事,我在等風也等你,苦酒折柳今相離,無風無月也無你。