Closed oaHeZgnoS closed 5 years ago
Please add your configuration
Hey, guy, I tried again on my company's PC and tried on my house's PC. And those project codes are same(copy). Unexpectedly, it runs successfully on my house's PC. And it runs unsuccessfully on my company's PC.
My env on my house's PC: jdk 1.8(same with company's PC), Eclipse Mars2(differ from company's PC Mars1), Maven 3.xx(I forgot it. Company's Maven is 3.6.0).
And I compared house's jar with company's jar. I discovered that company's jar lacks 3 jars(JavaEWAH-1.1.6.jar, jsch-0.1.54.jar, jzlib-1.1.1.jar). Then I check my pom.xml, those scope are compile. However, those three haven't been packaged in company's jar. Maybe this is my env's problem rather than a bug of SpringCloudConfig...
My pom.xml: `<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.cjia</groupId>
<artifactId>spider-config</artifactId>
<version>1.0.0</version>
<name>config</name>
<description>SpringCloudConfig for spider</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- log4j -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
<version>1.3.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- spring-security -->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency> -->
<!-- 消息总线 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
`
My application.properties: `spring.application.name=spider-config server.port=7001
eureka.client.serviceUrl.defaultZone=http://peer1:1111/eureka/,http://peer2:1112/eureka/
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=E:/codes_svn/spider_trunk/spider-config/src/main/resources/properties
spring.kafka.bootstrap-servers=10.1.4.17:9092
spring.cloud.bus.trace.enabled=true
management.endpoints.web.exposure.include=bus-refresh `
Finally, maybe I can forcely and directly add those three dependences to resolve my problem. But I hope to find its root cause.
Add another point, I could run successfully on my company's PC and run in Eclipse. If I try it by 'java -jar xx.jar', it's always lose.
I have discovered the root cause by using 'mvn -X'. I delete sth(download Incomplete bad pom) in mvn repo. Then those three jars are packaged.
This is not a bug. Please close it.
My Env: SpringBoot2.1.3, SpringCloud Grenwich, Jdk 1.8, Native repository(I use my local disk as my config repo rather than git or svn..)
It runs ok when I use Eclipse to start directly.However, when I use "java -jar myconfigserver.jar", Error occurred: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'multipleJGitEnvironmentProperties': Could not bind properties to 'MultipleJGitEnvironmentProperties' : prefix=spring.cloud.config.server.git, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.cloud.config.server.git' to org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentProperties
Waiting for your answer.