当前位置:网站首页>Record a service deployment failure troubleshooting
Record a service deployment failure troubleshooting
2022-07-01 02:31:00 【luxinfeng666】
background
Last Friday, after the local development of a certain function was completed , It needs to be deployed to the offline environment for front and rear end joint commissioning . Prompt during deployment “ The process restarts repeatedly ” So the deployment fails , When starting locally, the code can start normally .
The screening process
First log in to the deployed offline machine , View the deployment log , Prompt in the discovery log “war Package is damaged or invalid ”. decompression war package , Tips war Package is empty , So there should be an error when building the package ( When building packages , The company's platform has always been prompted that the construction and packaging have been successful , So at first, I thought there was a problem with the compiled or deployed script , No problem found after inspection ).
Then check the log of the build package , I found that there was a mistake in this place , The reason for the error is
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.7:repackage (repackage) on project demo: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.6.7
:repackage failed: Unable to find a single main class from the following candidates [com.example.demo.DemoApplication, com.example.demo.service.MainService] -> [Help 1]
It's easy to find the cause of the error , The error prompt has stated that there is more than one main function in the code . And already in [] The classes with main functions are marked in , We just need to delete the redundant main functions or in pom Just indicate the main function in the file .
terms of settlement
I'm here because another main function was inadvertently brought in , So delete the redundant main function . In addition to removing redundant main functions , We can still do that pom Specify the main function in the file . Or use @SpringBootApplication Annotation is OK .
stay pom The document specifies
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.9.RELEASE</version>
<configuration>
<mainClass>com.xx.xxx.startApp</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Use @SpringBootApplication annotation
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
This can also solve the above problems .
reflection
Why is it IDEA It can start normally in ?
because IDEA The main function is explicitly specified in the configuration of .
PS: The project construction failed, but the company platform suggested that the construction and packaging were successful, which misled me for a long time ==
边栏推荐
- How do the top ten securities firms open accounts? Also, is it safe to open an account online?
- 鼠标悬停效果八
- map数组函数
- Focusing on green and low carbon, data center cooling has entered a new era of "intelligent cooling"
- Comment réaliser la liaison entre la serrure intelligente et la lampe, la scène du moteur de rideau intelligent dans le timing intelligent?
- 【做题打卡】集成每日5题分享(第一期)
- QML control type: tooltip
- 鼠标悬停效果五
- LabVIEW calculates the camera image sensor resolution and lens focal length
- SWT / anr issues - ams/wms
猜你喜欢
随机推荐
Zero foundation self-study SQL course | window function
How to use Jieba participle in unity
5款主流智能音箱入门款测评:苹果小米华为天猫小度,谁的表现更胜一筹?
Sampling Area Lights
SWT / anr problem - deadlock
What are the top ten securities companies? In addition, is it safe to open an account online now?
C # generates PPK files in putty format (supports passphrase)
股票开账户如何优惠开户?还有,在线开户安全么?
园区运营效率提升,小程序容器技术加速应用平台化管理
522. Longest special sequence II
go: finding module for package
(translation) reasons why real-time inline verification is easier for users to make mistakes
SWT/ANR问题--ANR/JE引发SWT
js中的图片预加载
What is the difference between port number and process number?
VirtualBox installation enhancements
Xception学习笔记
手机上怎么开户?还有,在线开户安全么?
Pulsar 主题压缩
我的PMP学习考试心得









