我将项目从jhipster 5.8.2升级到6.5.1。
在Windows计算机上,一切都可以在开发模式下正常工作
现在,我尝试在我的Test heroku平台上进行部署,但是我有一个例外:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException:
Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'servletEndpointRegistrar'
defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:
Factory method 'servletEndpointRegistrar' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'auditEventsEndpoint'
defined in class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'auditEventsEndpoint' parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'customAuditEventRepository'
defined in URL [jar:file:/app/build/libs/yvidya-0.0.1-SNAPSHOT.war!/WEB-INF/classes!/fr/yoni/yvidya/repository/CustomAuditEventRepository.class]:
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'persistenceAuditEventRepository':
Cannot create inner bean '(inner bean)#75cf0de5' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name '(inner bean)#75cf0de5': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Invocation of init method failed;
这是我的CustomAuditEventRepository
@Repository
public class CustomAuditEventRepository implements AuditEventRepository {
private static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE";
/**
* Should be the same as in Liquibase migration.
*/
protected static final int EVENT_DATA_COLUMN_MAX_LENGTH = 255;
private final PersistenceAuditEventRepository persistenceAuditEventRepository;
private final AuditEventConverter auditEventConverter;
private final Logger log = LoggerFactory.getLogger(getClass());
public CustomAuditEventRepository(PersistenceAuditEventRepository persistenceAuditEventRepository,
AuditEventConverter auditEventConverter) {
this.persistenceAuditEventRepository = persistenceAuditEventRepository;
this.auditEventConverter = auditEventConverter;
}
对于部署,我使用gitlab-ci,启动脚本为:
./gradlew compileJava -x check -PnodeInstall --no-daemon
./gradlew -Pint -Pwar clean bootWar
rm -rf build/libs/yvidya-*original.war
heroku plugins:install java
heroku deploy:jar build/libs/*.war --app yvidya-int
还有我的配置数据库:
@Configuration
@EnableJpaRepositories("fr.yoni.yvidya.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
}
我的配置JDBC
spring:
profiles:
include:
- swagger
devtools:
restart:
enabled: false
livereload:
enabled: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgres://XXXX.compute.amazonaws.com:5432/YYYYYY
username: YYIYYI
password: TTTTTTTTTTTTTTTTTTTTTTTTTTTTT
hikari:
poolName: Hikari
auto-commit: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL95Dialect
database: POSTGRESQL
您知道为什么自升级以来我无法在heroku上进行部署吗?