当前位置:网站首页>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 ==
边栏推荐
- Optimal Transport系列1
- Small program cloud development -- wechat official account article collection
- centos 安装多个版本的php并切换
- URLs and URIs
- Qu'est - ce que le PMP?
- What is the difference between port number and process number?
- Ernie gram, an explicit and complete n-gram mask language model, implements explicit n-gram semantic unit knowledge modeling.
- Nacos configuration center tutorial
- What are the top ten securities companies? In addition, is it safe to open an account online now?
- SAP ALV summary is inconsistent with exported excel summary data
猜你喜欢

@ConfigurationProperties和@Value的区别

A preliminary understanding of operator overloading

视觉特效,图片转成漫画功能

我的PMP学习考试心得

My PMP learning test experience

Pulsar geo replication/ disaster recovery / regional replication

手机edge浏览器无法打开三方应用

Restcloud ETl数据通过时间戳实现增量数据同步

RestCloud ETL WebService数据同步到本地

AI edge computing platform - beaglebone AI 64 introduction
随机推荐
使用ipmitool配置X86服务器的BMC网络和用户信息
Applet custom top navigation bar, uni app wechat applet custom top navigation bar
Do you write API documents or code first?
手机上怎么开户?还有,在线开户安全么?
7_ Openresty installation
Pychart software deployment gray unable to point
SAP ALV汇总跟导出Excel 汇总数据不一致
QML control type: tooltip
手机edge浏览器无法打开三方应用
查看 jvm 参数
项目管理是什么?
鼠标悬停效果七
import tensorflow. contrib. Slim as slim error
Calculate special bonus
最新微信ipad协议 CODE获取 公众号授权等
go: finding module for package
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
Go import self built package
Detailed data governance knowledge system
The mobile edge browser cannot open the third-party application