У меня есть проблема, и я не знаю, как ее решить. Я хочу развернуть приложение Spring Boot с Gradle для Google App Engine. Он хорошо работает на моем локальном компьютере, и когда я использую задачу Gradle, AppEngine запускается, он также отлично работает, но когда я его развертываю и, нажимая на ссылку, выдает ClassNotFoundException:
at org.postgresql.core.PGStream.<init> (PGStream.java:60)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl (ConnectionFactoryImpl.java:144)
at org.postgresql.core.ConnectionFactory.openConnection (ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init> (PgConnection.java:194)
at org.postgresql.Driver.makeConnection (Driver.java:450)
at org.postgresql.Driver.connect (Driver.java:252)
at com.zaxxer.hikari.util.DriverDataSource.getConnection (DriverDataSource.java:136)
at com.zaxxer.hikari.pool.PoolBase.newConnection (PoolBase.java:369)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry (PoolBase.java:198)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry (HikariPool.java:467)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast (HikariPool.java:541)
at com.zaxxer.hikari.pool.HikariPool.<init> (HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.getConnection (HikariDataSource.java:112)
Caused by: java.lang.ClassNotFoundException: com.google.appengine.api.ThreadManager
at java.net.URLClassLoader.findClass (URLClassLoader.java:381)
at com.google.apphosting.runtime.ApplicationClassLoader.findClass (ApplicationClassLoader.java:135)
at java.lang.ClassLoader.loadClass (ClassLoader.java:424)
at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java:265)
at com.google.common.util.concurrent.MoreExecutors.platformThreadFactory (MoreExecutors.java:755)
Я думаю, что это имеет отношение к пути к классам, но я действительно не знаю, что это такое. Для развертывания я использую задачу gradle appenginedeploy, и мой build.gradle выглядит так
buildscript { // Configuration for building
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.+' // Latest 1.x.x releas
}
}
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
id 'org.hidetake.appengine.spring.boot' version '1.1'
id 'war'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks
group = 'de.msm'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
targetCompatibility = 1.8 // App Engine Flexible uses Java 8
appengine { // App Engine tasks configuration
deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
}
repositories {
mavenCentral()
jcenter()
jcenter{
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
compile group: 'org.springframework.boot', name: 'spring-boot-devtools'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile group: 'org.springframework', name: 'spring-test', version: '5.1.5.RELEASE'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'com.github.javafaker:javafaker:0.17.2'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on'
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
compile 'org.springframework.boot:spring-boot-starter-mail:2.1.5.RELEASE'
compile 'org.springframework:spring-context-support:5.1.7.RELEASE'
testCompile 'io.rest-assured:rest-assured:4.0.0'
compile 'io.rest-assured:xml-path:4.0.0'
compile 'io.rest-assured:json-path:4.0.0'
testCompile 'io.rest-assured:json-schema-validator:4.0.0'
compile group: 'joda-time', name: 'joda-time', version: '2.10.3'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.1'
testCompile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'
compile group: 'org.xhtmlrenderer', name: 'flying-saucer-pdf', version: '9.1.18'
compile "org.apache.pdfbox:pdfbox-tools:2.0.3"
compile "org.apache.poi:poi-ooxml:3.15"
compile "org.apache.poi:poi-scratchpad:3.15"
compile "xerces:xercesImpl:2.8.0"
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'com.google.cloud', name: 'google-cloud-storage', version: '1.91.0'
compile group: 'org.postgresql', name: 'postgresql', version: '42.1.4'
compile group: 'org.passay', name: 'passay', version: '1.0'
compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.0.4.RELEASE"
//Enable for Connect to GCloud
implementation("org.springframework.cloud:spring-cloud-gcp-starter-sql-postgresql:1.1.3.RELEASE")
implementation("org.springframework.cloud:spring-cloud-gcp-dependencies:1.1.3.RELEASE")
implementation("org.springframework.cloud:spring-cloud-gcp-starter:1.1.3.RELEASE")
compile 'com.google.cloud:google-cloud:+'
//Enable for Deployment
compile 'com.google.appengine:appengine-api-1.0-sdk:+'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile "javax.servlet:javax.servlet-api:3.1.0"
}
//Enable for Deployment
configurations.all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
exclude group: 'org.slf4j', module: 'jul-to-slf4j'
}