spring-boot - Google AppEngine 上的 SpringBoot 无法找到或加载主类
问题描述
我使用 Spring Boot 创建了一个应用程序,并尝试将其部署到 Google AppEngine,但是当我的应用程序出现在日志中时,我看到了这条消息
Error: Could not find or load main class [MyMainClass]
这是app.yaml
文件
runtime: java11
instance_class: F1
env: standard
entrypoint: java -cp "*" [MyMainClass] [ProjectName]-0.4.0.war
handlers:
- url: /(.*\.(gif|png|jpg|js|css|env))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
这是appengine-web.xml
文件
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<version>1</version>
<threadsafe>true</threadsafe>
<runtime>java11</runtime>
<system-properties>
<property name="java.util.logging.config.file" value="classes/logging.properties"/>
</system-properties>
<public-root>/src/main/webapp</public-root>
<resource-files>
<include path="/**.xml" />
<exclude path="**/Icon\n" />
<exclude path="**/Icon\n\r" />
<exclude path="**/Icon\r" />
<exclude path="**/Icon\r\n" />
</resource-files>
</appengine-web-app>```
解决方案
我以这种方式修复:
- 进入
POM
我将包设置为jar
...
<groupId>MyPackages</groupId>
<artifactId>MyProject</artifactId>
<version>MyVersion</version>
<packaging>jar</packaging>
...
- 进入
app.yaml
我设置入口点
entrypoint: java -Xmx64m -jar target/[MyPackage.MyProject-MyVersion].jar
推荐阅读
- ios - 如何从 SKscene 检测设备旋转
- javascript - 隐藏表格行的包含超链接文本,直到搜索到
- excel - 如果合并的单元格为空,则删除行
- javafx - 如何单击 GridPane 单元并让它执行操作?
- node.js - What is module.js 540 throw error?
- c++ - 这个 priorityQueue 析构函数的时间复杂度是多少?
- go - Go 中应用程序上下文中的 REPL 控制台
- google-apps-script - 使用 Google API 脚本从文件夹中的所有电子表格中删除重复行
- powershell - 更改 json 值
- python - 计算文本文件python中每一行的值