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

时间:2019-03-29 14:29:11

标签: spring spring-boot liquibase

我通过将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

2 个答案:

答案 0 :(得分:0)

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

所以在您的pom.xml中

<packaging>jar</packaging>

答案 1 :(得分:0)

您在MAX(col3) OVER (PARTITION BY col1 (CASE WHEN col2='ADM' THEN col2 END) ORDER BY col1) 这个课程上遇到问题

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