当前位置:网站首页>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 ==
边栏推荐
- Fix names in the table (first character uppercase, other lowercase)
- Pulsar geo replication/ disaster recovery / regional replication
- SWT/ANR问题--AMS/WMS
- How to add a condition for an associated table in an SQL statement [null value required or not required]
- How to learn and read code
- AI edge computing platform - beaglebone AI 64 introduction
- Image preloading in JS
- SWT / anr issues - ams/wms
- Some uses of Halcon array
- Analysis and solution of anr problems
猜你喜欢

js中的图片预加载

SWT/ANR问题--Binder Stuck

最新微信ipad协议 CODE获取 公众号授权等

How to use Jieba participle in unity

详解数据治理知识体系

QML control type: tooltip

MnasNet学习笔记

零基础自学SQL课程 | 窗口函数

Ernie gram, an explicit and complete n-gram mask language model, implements explicit n-gram semantic unit knowledge modeling.

Pychar open remote directory remote host
随机推荐
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
[multi source BFS] 934 Shortest Bridge
Leetcode interview question 17.10 Main elements
[2022] Jiangxi postgraduate mathematical modeling scheme and code
Visual effects, picture to cartoon function
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]
Pycharm 打开远程目录 Remote Host
Pulsar geo replication/ disaster recovery / regional replication
Evaluation of the entry-level models of 5 mainstream smart speakers: apple, Xiaomi, Huawei, tmall, Xiaodu, who is better?
Is there any discount for opening an account now? In addition, is it safe to open a mobile account?
Delete duplicate email
SWT / anr problem - SWT caused by too long dump time
JS anti shake and throttling
UE4渲染管线学习笔记
SWT / anr problem - deadlock
Optimal Transport系列1
[JS] [Nuggets] get people who are not followers
SWT/ANR问题--AMS/WMS
【微信小程序开发】样式汇总
How do the top ten securities firms open accounts? Also, is it safe to open an account online?