我正在尝试将jhipster微服务推向Cloud Foundry。当我将其打包用于生产时,微服务在本地可以正常工作,但是在推送到Cloud Foundry时失败。
背景:我有一个来自EGADS库的jar,但是我更改了一些我想要的功能的源代码。因此,我将其用作微服务中的第三方jar文件。
Cloud Foundry的日志如下:
2018-08-15T15:42:14.769-06:00 [APP / PROC / WEB / 0] [ERR]中的异常 线程“主” java.lang.reflect.InvocationTargetException 2018-08-15T15:42:14.769-06:00 [APP / PROC / WEB / 0] [ERR]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 2018-08-15T15:42:14.769-06:00 [APP / PROC / WEB / 0] [ERR]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在java.lang.reflect.Method.invoke(Method.java:498) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.springframework.boot.loader.Launcher.launch(Launcher.java:87) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]原因:java.lang.AbstractMethodError: org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(Lorg / apache / logging / log4j / core / config / ConfigurationSource;)Lorg / apache / logging / log4j / core / config / Configuration; 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.config.ConfigurationFactory $ Factory.getConfiguration(ConfigurationFactory.java:472) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.config.ConfigurationFactory $ Factory.getConfiguration(ConfigurationFactory.java:442) 2018-08-15T15:42:14.770-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:254) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:425) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:442) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.logging.log4j.LogManager.getContext(LogManager.java:175) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.commons.logging.LogFactory $ Log4jLog。(LogFactory.java:199) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.commons.logging.LogFactory $ Log4jDelegate.createLog(LogFactory.java:166) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在org.springframework.boot.SpringApplication。(SpringApplication.java:198) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR]在com.comcast.egads.EgadsApp.main(EgadsApp.java:60) 2018-08-15T15:42:14.771-06:00 [APP / PROC / WEB / 0] [ERR] ...还有8个 2018-08-15T15:42:14.798-06:00 [APP / PROC / WEB / 0] [OUT]退出状态1
这是我对Micro服务的pom文件依赖关系(没有足够的空间容纳整个pom文件):
<dependencies>
<dependency>
<groupId>io.github.jhipster</groupId>
<artifactId>jhipster-framework</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-annotation</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-json</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlet</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hppc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-json-org</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-afterburner</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
<!-- parent POM declares this dependency in default (compile) scope -->
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
</dependency>
<dependency>
<groupId>com.ryantenney.metrics</groupId>
<artifactId>metrics-spring</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader-tools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zalando</groupId>
<artifactId>problem-spring-web</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
</dependency>
<!-- Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
</dependency>
<!-- jhipster-needle-maven-add-dependency -->
<dependency>
<groupId>com.github.lbordowitz.openforecast</groupId>
<artifactId>openforecast</artifactId>
<version>0.5.0</version>
</dependency>
<dependency>
<groupId>com.comcast.egads</groupId>
<artifactId>comcastEgads</artifactId>
<version>0.0.2</version>
</dependency>
</dependencies>
问题是否也可能源于我正在使用的第3个第三方jar中的pom文件?我只是想找出问题的根源。
我查看了How to set up Spring Boot and log4j2 properly?,Log4J 2 version not working with RabbitMQ & Spring Boot,spring-boot + cloud log4j version compatibity issue when using SerialisedLayout socket appender等内容,但还没有找到可以解决我问题的方法。