创建war文件后我的spring启动项目无法使用java-jar命令运行

问题描述 投票:0回答:2

我使用jhipster和springboot,liquidbase,hibernate exc创建了一个新的Java项目。技术,但当我尝试通过调用“java -jar ...... SNAPSHOT.war”文件来部署我的项目时,它显示错误像

"The following profiles are active: prod
   2019-03-29 17:12:25.912  WARN 21772 --- [           main] 
ConfigServletWebServerApplicationContext : 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:/C:/work/workspaceAngular/puantaj-hesaplama/target/puantaj-hesaplama-0.0.1-SNAPSHOT.war!/WEB-INF/classes!/com/sbb/puantajhesaplama/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)#aa22f1c' 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)#aa22f1c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/sbb/puantajhesaplama/config/LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NullPointerException
spring spring-boot liquibase
2个回答
0
投票

你在CustomAuditEventRepository这堂课有问题

与gist.github.com分享您的代码


0
投票

如果你想用java -jar运行它,你必须构建一个JAR而不是WAR。

所以在你的pom.xml中

<packaging>jar</packaging>
© www.soinside.com 2019 - 2024. All rights reserved.