【发布时间】:2020-04-28 20:49:30
【问题描述】:
我创建了一个简单的(几乎是空的)spring boot 项目,我打包成一个 jar 并将它部署在 appengine 上。 但它没有开始! 当我运行 https://.appspot.com 时出现 500 错误页面
我看到数据库和表也已创建,但应用程序有问题
这些是日志的最后几行
在 9.729 秒内启动 VibesCoreApplication(JVM 运行 11.147)
关闭 ExecutorService 'taskScheduler'
为持久性单元“默认”关闭 JPA EntityManagerFactory
HikariPool-1 - 已启动关机...
HikariPool-1 - 关闭完成。
这是pom 文件的一部分
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- for GAE -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- for GAE -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-sqladmin</artifactId>
<version>v1beta4-rev76-1.25.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter</artifactId>
<version>LATEST</version>
</dependency>
<!-- JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
<scope>runtime</scope>
</dependency>
</dependencies>
这是app.yaml 文件
runtime: java11
instance_class: F2
env: standard
network:
session_affinity: true
entrypoint: java -Xmx64m -jar target/vibes-core-0.4.0.jar
handlers:
- url: /(.*\.(gif|png|jpg|js|css|env))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
这里有完整的logs
【问题讨论】:
-
这似乎是一个 Spring 配置问题。你在你的应用中使用@EnableAutoConfiguration 注解吗?
-
@AndreiTigau 是的,我愿意。我也用
@SpringBootApplication注解
标签: spring-boot google-app-engine