tcpgateway網關調試

遇到衝突的時候第一步要找到maven加載的到時是什麼版本的jar包,通過們mvn dependency:tree查看依賴樹,
通過maven的依賴原則來調整座標在pom文件的申明順序是最好的辦法。
mvn dependency:tree

[INFO] com.reachauto.vspcloud:poccloud-poc-tcpgateway:jar:1.0.0
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.2.5.RELEASE:provided
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.25:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.3:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.5.RELEASE:provided
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.31:provided
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.31:provided
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.31:provided
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  |  \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:5.2.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.2.4.RELEASE:provided
[INFO] |     +- org.springframework:spring-aop:jar:5.2.4.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework.kafka:spring-kafka:jar:2.3.6.RELEASE:compile
[INFO] |  +- org.apache.kafka:kafka-clients:jar:2.3.1:compile
[INFO] |  |  +- com.github.luben:zstd-jni:jar:1.4.0-1:compile
[INFO] |  |  +- org.lz4:lz4-java:jar:1.6.0:compile
[INFO] |  |  \- org.xerial.snappy:snappy-java:jar:1.1.7.3:compile
[INFO] |  +- org.springframework.retry:spring-retry:jar:1.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-messaging:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:5.2.4.RELEASE:compile
[INFO] +- org.apache.activemq:activemq-client:jar:5.15.11:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] |  +- org.fusesource.hawtbuf:hawtbuf:jar:1.11:compile
[INFO] |  \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] +- io.netty:netty-all:jar:4.0.30.Final:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-common-core:jar:1.0.2:compile
[INFO] |  +- mysql:mysql-connector-java:jar:8.0.18:runtime
[INFO] |  |  \- com.google.protobuf:protobuf-java:jar:3.11.4:runtime
[INFO] |  +- com.baomidou:mybatis-plus-boot-starter:jar:3.2.0:compile
[INFO] |  |  +- com.baomidou:mybatis-plus:jar:3.2.0:compile
[INFO] |  |  |  \- com.baomidou:mybatis-plus-extension:jar:3.2.0:compile
[INFO] |  |  |     +- com.baomidou:mybatis-plus-core:jar:3.2.0:compile
[INFO] |  |  |     |  +- com.baomidou:mybatis-plus-annotation:jar:3.2.0:compile
[INFO] |  |  |     |  +- com.github.jsqlparser:jsqlparser:jar:2.1:compile
[INFO] |  |  |     |  \- org.mybatis:mybatis:jar:3.5.2:compile
[INFO] |  |  |     \- org.mybatis:mybatis-spring:jar:2.0.2:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-jdbc:jar:2.2.5.RELEASE:compile
[INFO] |  |     +- com.zaxxer:HikariCP:jar:3.4.2:compile
[INFO] |  |     \- org.springframework:spring-jdbc:jar:5.2.0.RELEASE:compile
[INFO] |  +- com.alibaba:druid-spring-boot-starter:jar:1.1.20:compile
[INFO] |  |  \- com.alibaba:druid:jar:1.1.20:compile
[INFO] |  +- com.google.zxing:core:jar:3.1.0:compile
[INFO] |  +- io.springfox:springfox-swagger2:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-spi:jar:2.9.2:compile
[INFO] |  |  |  \- io.springfox:springfox-core:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-schema:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-spring-web:jar:2.9.2:compile
[INFO] |  |  +- com.google.guava:guava:jar:28.2-android:compile
[INFO] |  |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  |  +- org.checkerframework:checker-compat-qual:jar:2.5.5:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |  |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] |  |  \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
[INFO] |  +- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.21:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.21:compile
[INFO] |  +- cn.hutool:hutool-all:jar:4.1.19:compile
[INFO] |  +- io.jsonwebtoken:jjwt:jar:0.7.0:compile
[INFO] |  +- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.13:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-common-log:jar:1.0.7:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  +- com.github.danielwegener:logback-kafka-appender:jar:0.2.0-RC2:compile
[INFO] |  +- net.logstash.logback:logstash-logback-encoder:jar:5.3:compile
[INFO] |  \- org.codehaus.janino:janino:jar:3.1.0:compile
[INFO] |     \- org.codehaus.janino:commons-compiler:jar:3.1.0:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-component-oss:jar:1.1.2:compile
[INFO] |  \- com.aliyun.oss:aliyun-sdk-oss:jar:3.1.0:compile
[INFO] |     +- org.apache.httpcomponents:httpclient:jar:4.5.11:compile
[INFO] |     |  \- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] |     +- org.jdom:jdom:jar:1.1:compile
[INFO] |     +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] |     |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |     |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |     |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] |     |  +- org.codehaus.jackson:jackson-core-asl:jar:1.8.3:compile
[INFO] |     |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
[INFO] |     |  +- org.codehaus.jackson:jackson-xc:jar:1.8.3:compile
[INFO] |     |  \- com.sun.jersey:jersey-core:jar:1.9:compile
[INFO] |     +- com.aliyun:aliyun-java-sdk-core:jar:4.4.1:compile
[INFO] |     |  +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] |     |  |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |     |  +- org.jacoco:org.jacoco.agent:jar:runtime:0.8.3:compile
[INFO] |     |  \- org.ini4j:ini4j:jar:0.5.4:compile
[INFO] |     +- com.aliyun:aliyun-java-sdk-ram:jar:3.0.0:compile
[INFO] |     +- com.aliyun:aliyun-java-sdk-sts:jar:3.0.0:compile
[INFO] |     \- com.aliyun:aliyun-java-sdk-ecs:jar:4.2.0:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-component-redis:jar:1.0.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-data-redis:jar:2.2.5.RELEASE:compile
[INFO] |  |  \- org.springframework.data:spring-data-redis:jar:2.2.5.RELEASE:compile
[INFO] |  |     +- org.springframework.data:spring-data-keyvalue:jar:2.2.5.RELEASE:compile
[INFO] |  |     |  \- org.springframework.data:spring-data-commons:jar:2.2.5.RELEASE:compile
[INFO] |  |     +- org.springframework:spring-oxm:jar:5.2.4.RELEASE:compile
[INFO] |  |     \- org.springframework:spring-context-support:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.apache.commons:commons-pool2:jar:2.7.0:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-common-exception:jar:1.1.1:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.4.1.Final:compile
[INFO] |  |  \- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  \- com.alibaba.csp:sentinel-core:jar:1.7.1:compile
[INFO] +- org.powermock:powermock-core:jar:2.0.2:test
[INFO] |  +- org.powermock:powermock-reflect:jar:2.0.2:test
[INFO] |  +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.10.8:compile
[INFO] |  \- net.bytebuddy:byte-buddy-agent:jar:1.10.8:test
[INFO] +- org.powermock:powermock-module-junit4:jar:2.0.2:test
[INFO] |  +- org.powermock:powermock-module-junit4-common:jar:2.0.2:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:2.1:test
[INFO] +- org.powermock:powermock-api-mockito2:jar:2.0.2:test
[INFO] |  \- org.powermock:powermock-api-support:jar:2.0.2:test
[INFO] +- com.alibaba:dubbo:jar:2.5.3:compile
[INFO] |  \- org.jboss.netty:netty:jar:3.2.5.Final:compile
[INFO] +- io.dropwizard.metrics:metrics-core:jar:3.1.0:compile
[INFO] +- com.esotericsoftware.kryo:kryo:jar:2.16:compile
[INFO] |  +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.06:compile
[INFO] |  |  \- org.ow2.asm:asm:jar:4.0:compile
[INFO] |  +- com.esotericsoftware.minlog:minlog:jar:1.2:compile
[INFO] |  \- org.objenesis:objenesis:jar:1.2:compile
[INFO] +- com.kora:satl:jar:1.0:compile
[INFO] +- com.kora:kora-component-dbc:jar:1.5:compile
[INFO] +- com.reachauto.vspcloud:vspcloud-common-sentinel:jar:1.0.0:compile
[INFO] |  +- com.alibaba.csp:sentinel-cluster-server-default:jar:1.7.1:compile
[INFO] |  |  +- com.alibaba.csp:sentinel-cluster-common-default:jar:1.7.1:compile
[INFO] |  |  +- com.alibaba.csp:sentinel-parameter-flow-control:jar:1.7.1:compile
[INFO] |  |  |  \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.4.2:compile
[INFO] |  |  \- io.netty:netty-handler:jar:4.1.45.Final:compile
[INFO] |  |     +- io.netty:netty-common:jar:4.1.45.Final:compile
[INFO] |  |     +- io.netty:netty-buffer:jar:4.1.45.Final:compile
[INFO] |  |     +- io.netty:netty-transport:jar:4.1.45.Final:compile
[INFO] |  |     |  \- io.netty:netty-resolver:jar:4.1.45.Final:compile
[INFO] |  |     \- io.netty:netty-codec:jar:4.1.45.Final:compile
[INFO] |  +- com.alibaba.csp:sentinel-cluster-client-default:jar:1.7.1:compile
[INFO] |  +- com.alibaba.csp:sentinel-transport-simple-http:jar:1.7.1:compile
[INFO] |  |  \- com.alibaba.csp:sentinel-transport-common:jar:1.7.1:compile
[INFO] |  +- org.apache.curator:curator-recipes:jar:4.0.1:compile
[INFO] |  |  \- org.apache.curator:curator-framework:jar:4.0.1:compile
[INFO] |  |     \- org.apache.curator:curator-client:jar:4.0.1:compile
[INFO] |  +- org.apache.curator:curator-x-discovery:jar:4.0.1:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  \- org.apache.zookeeper:zookeeper:jar:3.4.14:compile
[INFO] |     +- com.github.spotbugs:spotbugs-annotations:jar:3.1.9:compile
[INFO] |     +- log4j:log4j:jar:1.2.17:compile
[INFO] |     +- jline:jline:jar:0.9.94:compile
[INFO] |     +- org.apache.yetus:audience-annotations:jar:0.5.0:compile
[INFO] |     \- io.netty:netty:jar:3.10.6.Final:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.22:compile
[INFO] +- redis.clients:jedis:jar:2.9.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.2.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.2.5.RELEASE:compile
[INFO] |  |  +- io.projectreactor.netty:reactor-netty:jar:0.9.5.RELEASE:compile
[INFO] |  |  |  +- io.netty:netty-codec-http:jar:4.1.45.Final:compile
[INFO] |  |  |  +- io.netty:netty-codec-http2:jar:4.1.45.Final:compile
[INFO] |  |  |  +- io.netty:netty-handler-proxy:jar:4.1.45.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec-socks:jar:4.1.45.Final:compile
[INFO] |  |  |  \- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.45.Final:compile
[INFO] |  |  |     \- io.netty:netty-transport-native-unix-common:jar:4.1.45.Final:compile
[INFO] |  |  \- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] |  +- org.springframework:spring-webflux:jar:5.2.4.RELEASE:compile
[INFO] |  |  \- io.projectreactor:reactor-core:jar:3.3.3.RELEASE:compile
[INFO] |  |     \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] |  \- org.synchronoss.cloud:nio-multipart-parser:jar:1.1.0:compile
[INFO] |     \- org.synchronoss.cloud:nio-stream-storage:jar:1.1.3:compile
[INFO] +- com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:jar:2.2.0.RELEASE:compile
[INFO] |  \- com.alibaba.cloud:spring-cloud-alibaba-nacos-discovery:jar:2.2.0.RELEASE:compile
[INFO] |     +- com.alibaba.spring:spring-context-support:jar:1.0.5:compile
[INFO] |     \- org.springframework.cloud:spring-cloud-context:jar:2.2.2.RELEASE:compile
[INFO] +- com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:jar:2.2.0.RELEASE:compile
[INFO] |  \- com.alibaba.cloud:spring-cloud-alibaba-nacos-config:jar:2.2.0.RELEASE:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-netflix-ribbon:jar:2.2.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:2.2.2.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.9.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-ribbon:jar:2.2.2.RELEASE:compile
[INFO] |  |  \- org.springframework.cloud:spring-cloud-netflix-archaius:jar:2.2.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-netflix-archaius:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- com.netflix.archaius:archaius-core:jar:0.7.6:compile
[INFO] |  |  \- commons-configuration:commons-configuration:jar:1.8:compile
[INFO] |  +- com.netflix.ribbon:ribbon:jar:2.3.0:compile
[INFO] |  |  +- com.netflix.ribbon:ribbon-transport:jar:2.3.0:runtime
[INFO] |  |  |  +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
[INFO] |  |  |  \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
[INFO] |  |  +- com.netflix.hystrix:hystrix-core:jar:1.5.18:compile
[INFO] |  |  +- javax.inject:javax.inject:jar:1:runtime
[INFO] |  |  \- io.reactivex:rxnetty:jar:0.4.9:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-core:jar:2.3.0:compile
[INFO] |  |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- com.netflix.ribbon:ribbon-httpclient:jar:2.3.0:compile
[INFO] |  |  +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
[INFO] |  |  +- com.netflix.servo:servo-core:jar:0.12.21:runtime
[INFO] |  |  \- com.netflix.netflix-commons:netflix-commons-util:jar:0.3.0:runtime
[INFO] |  +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.3.0:compile
[INFO] |  |  \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
[INFO] |  \- io.reactivex:rxjava:jar:1.3.8:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-openfeign:jar:2.2.2.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-openfeign-core:jar:2.2.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.2.5.RELEASE:compile
[INFO] |  |  \- io.github.openfeign.form:feign-form-spring:jar:3.8.0:compile
[INFO] |  |     +- io.github.openfeign.form:feign-form:jar:3.8.0:compile
[INFO] |  |     \- commons-fileupload:commons-fileupload:jar:1.4:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-commons:jar:2.2.2.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-crypto:jar:5.2.2.RELEASE:compile
[INFO] |  +- io.github.openfeign:feign-core:jar:10.7.4:compile
[INFO] |  +- io.github.openfeign:feign-slf4j:jar:10.7.4:compile
[INFO] |  \- io.github.openfeign:feign-hystrix:jar:10.7.4:compile
[INFO] +- io.github.openfeign:feign-okhttp:jar:10.7.4:compile
[INFO] |  \- com.squareup.okhttp3:okhttp:jar:3.14.7:compile
[INFO] |     \- com.squareup.okio:okio:jar:1.17.2:compile
[INFO] +- com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:jar:2.2.0.RELEASE:compile
[INFO] |  \- com.alibaba.cloud:spring-cloud-alibaba-sentinel:jar:2.2.0.RELEASE:compile
[INFO] |     +- com.alibaba.csp:sentinel-annotation-aspectj:jar:1.7.1:compile
[INFO] |     |  \- org.aspectj:aspectjrt:jar:1.9.5:compile
[INFO] |     +- com.alibaba.cloud:spring-cloud-circuitbreaker-sentinel:jar:2.2.0.RELEASE:compile
[INFO] |     |  \- com.alibaba.csp:sentinel-reactor-adapter:jar:1.7.1:compile
[INFO] |     +- com.alibaba.csp:sentinel-spring-webflux-adapter:jar:1.7.1:compile
[INFO] |     +- com.alibaba.csp:sentinel-spring-webmvc-adapter:jar:1.7.1:compile
[INFO] |     \- com.alibaba.cloud:spring-cloud-alibaba-sentinel-datasource:jar:2.2.0.RELEASE:compile
[INFO] +- com.alibaba.csp:sentinel-datasource-nacos:jar:1.7.0:compile
[INFO] |  +- com.alibaba.csp:sentinel-datasource-extension:jar:1.7.1:compile
[INFO] |  \- com.alibaba.nacos:nacos-client:jar:1.1.4:compile
[INFO] |     +- com.alibaba.nacos:nacos-common:jar:1.1.4:compile
[INFO] |     +- com.alibaba.nacos:nacos-api:jar:1.1.4:compile
[INFO] |     \- io.prometheus:simpleclient:jar:0.5.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.2.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.2.5.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:2.2.5.RELEASE:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.3.5:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.11:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
[INFO] +- io.micrometer:micrometer-registry-prometheus:jar:1.3.2:compile
[INFO] |  \- io.prometheus:simpleclient_common:jar:0.7.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.2.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.2.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.5.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.5.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:test
[INFO] |  +- org.junit.vintage:junit-vintage-engine:jar:5.5.2:test
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  \- org.junit.platform:junit-platform-engine:jar:1.5.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.13.2:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.1:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:5.2.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-test:jar:5.2.4.RELEASE:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.6.3:test
[INFO] +- org.mockito:mockito-core:jar:3.1.0:test
[INFO] +- org.mockito:mockito-inline:jar:3.1.0:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:3.1.0:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:test
[INFO] |     +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |     \- org.junit.platform:junit-platform-commons:jar:1.5.2:test
[INFO] +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.10.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.3:compile
[INFO] +- com.alibaba:fastjson:jar:1.2.67:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.9:compile
[INFO] +- commons-io:commons-io:jar:2.5:compile
[INFO] \- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO]    +- commons-logging:commons-logging:jar:1.2:compile
[INFO]    \- commons-collections:commons-collections:jar:3.2.2:compile

2.7.0 2.9.0 衝突

依賴最短路徑優先原則

    一個項目Demo依賴了兩個jar包,其中A-B-C-X(1.0) , A-D-X(2.0)。由於X(2.0)路徑最短,所以項目使用的是X(2.0)。

pom文件中申明順序優先
如果A-B-X(1.0) ,A-C-X(2.0) 這樣的路徑長度一樣怎麼辦呢?這樣的情況下,maven會根據pom文件聲明的順序加載,如果先聲明瞭B,後聲明瞭C,那就最後的依賴就會是X(1.0)。

覆寫優先

子pom內聲明的優先於父pom中的依賴。

把這個依賴放到pom的最前面,沒好使

redis.clients
jedis
2.9.0

css的!important
div{color:#f00!important;}

剛纔吹噓dependency:tree時,我用到了“無處遁形”,其實有時你會發現簡單地用dependency:tree往往並不能查看到所有的傳遞依賴。不過如果
你真的想要看所有的,必須得加一個-Dverbose參數,這時就必定是最全的了。
全是全了,但顯示出來的東西太多,頭暈目眩,有沒有好法呢?當然有了,加上Dincludes或者Dexcludes說出你喜歡或討厭,dependency:tree就會幫你過濾出來:
引用
Dincludes=org.springframework:spring-tx
過濾串使用groupId:artifactId:version的方式進行過濾,可以不寫全啦,如:

mvn dependency:tree -Dverbose -Dincludes=asm:asm

就會出來asm依賴包的分析信息:

第二板斧:將不想要的傳遞依賴剪除掉

承上,假設我們不希望asm:asm:jar:1.5.3出現,根據分析,我們知道它是經由org.unitils:unitils-dbmaintainer:jar:3.3引入的,
那麼在pom.xml中找到這個依賴,做其它的調整:
mvn dependency:tree -Dverbose -Dincludes=org.apache.commons

<dependency>  
        <groupId>org.unitils</groupId>  
        <artifactId>unitils-dbmaintainer</artifactId>  
        <version>${unitils.version}</version>  
        <exclusions>  
            <exclusion>  
                <artifactId>dbunit</artifactId>  
                <groupId>org.dbunit</groupId>  
            </exclusion>  
            <!-- 這個就是我們要加的片斷 -->  
            <exclusion>  
                <artifactId>asm</artifactId>  
                <groupId>asm</groupId>  
            </exclusion>  
        </exclusions>  
    </dependency>  

第三板斧:查看運行期類來源的JAR包

有時,你以爲解決了,但是偏偏還是報類包衝突(典型症狀是java.lang.ClassNotFoundException或Method不兼容等異常),這時你可以設置一個斷點,在
斷點處通過下面這個我做的工具類來查看Class所來源的JAR包:

package com.mtons.mblog.leetcode;

import org.objectweb.asm.ClassVisitor;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;

public class ClassLocationUtils {
    /**
     * 獲取類所有的路徑
     *
     * @param cls
     * @return
     */
    public static String where(final Class cls) {
        if (cls == null) throw new IllegalArgumentException("null input: cls");
        URL result = null;
        final String clsAsResource = cls.getName().replace('.', '/').concat(".class");
        final ProtectionDomain pd = cls.getProtectionDomain();
        if (pd != null) {
            final CodeSource cs = pd.getCodeSource();
            if (cs != null) result = cs.getLocation();
            if (result != null) {
                if ("file".equals(result.getProtocol())) {
                    try {
                        if (result.toExternalForm().endsWith(".jar") ||
                                result.toExternalForm().endsWith(".zip"))
                            result = new URL("jar:".concat(result.toExternalForm())
                                    .concat("!/").concat(clsAsResource));
                        else if (new File(result.getFile()).isDirectory())
                            result = new URL(result, clsAsResource);
                    } catch (MalformedURLException ignore) {
                    }
                }
            }
        }
        if (result == null) {
            final ClassLoader clsLoader = cls.getClassLoader();
            result = clsLoader != null ?
                    clsLoader.getResource(clsAsResource) :
                    ClassLoader.getSystemResource(clsAsResource);
        }
        return result.toString();
    }

    public static void main(String[] args) {
        System.out.println(ClassLocationUtils.where(ClassVisitor.class));
    }
}

隨便寫一個測試,設置好斷點,在執行到斷點處按alt+F8動態執行代碼(intelij idea),假設我們輸入:
ClassLocationUtils.where(org.objectweb.asm.ClassVisitor.class)

即可馬上查出類對應的JAR了:

這就是org.objectweb.asm.ClassVisitor類在運行期對應的JAR包,如果這個JAR包版本不是你期望你,就說明是你的IDE緩存造成的,這時建議你
Reimport一下maven列表就可以了,如下所示(idea):

Reimport一下,IDE會強制根據新的pom.xml設置重新分析並加載依賴類包,以得到和pom.xml設置相同的依賴。(這一步非常重要哦,經常項目組pom.xml是
相同的,但是就是有些人可以運行,有些人不能運行,俗稱人品問題,其實都是IDE的緩存造成的了
idea清除緩存,爲了提高效率不建議採用reimport重新起開啓項目的方式,建議採用idea自帶的功能,File->Invalidate Caches 功能直接完成清除idea cache

成功找到衝突的依賴

[INFO] ± com.reachauto.vspcloud:vspcloud-component-redis:jar:1.0.0:compile
[INFO] | ± org.springframework.boot:spring-boot-starter-data-redis:jar:2.2.5.RELEASE:compile
[INFO] | | - org.springframework.data:spring-data-redis:jar:2.2.5.RELEASE:compile
[INFO] | | ± org.springframework.data:spring-data-keyvalue:jar:2.2.5.RELEASE:compile
[INFO] | | | - org.springframework.data:spring-data-commons:jar:2.2.5.RELEASE:compile
[INFO] | | ± org.springframework:spring-oxm:jar:5.2.4.RELEASE:compile
[INFO] | | - org.springframework:spring-context-support:jar:5.2.4.RELEASE:compile
[INFO] | - org.apache.commons:commons-pool2:jar:2.7.0:compile

[INFO] ± redis.clients:jedis:jar:2.9.0:compile

<dependency>
            <groupId>com.reachauto.vspcloud</groupId>
            <artifactId>vspcloud-component-redis</artifactId>
            <version>1.0.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>org.apache.commons</artifactId>
                    <groupId>commons-pool2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

又報錯:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.serve
r.WebServerException: Unable to start embedded Tomcat

idea 打開pom.xml文件,依次選擇Maven -> Show Dependencies…
樹狀的依賴關係,和dependency:tree命令結果一致,只不過是更形象的圖形化界面。
我的idea是旗艦版,聽說社區版沒有

Caused by: java.lang.NoClassDefFoundError: redis/clients/jedis/util/SafeEncoder
解決辦法:降低redis.clients的版本

com.reachauto.vspcloud vspcloud-component-redis 1.0.0 jedis redis.clients

在這裏插入圖片描述

Caused by: java.lang.NoClassDefFoundError: redis/clients/jedis/util/SafeEncoder
檢查端口號是否啓動
netstat -an|findstr “8999”

最終解決辦法:

<!--添加jedis客戶端-->
<!--<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>2.9.0</version>
</dependency>-->

修改類
import redis.clients.jedis.util.Pool;

nacos修改配置:

 # feign:
 #   sentinel:
 #     enabled: true
 #     client:
 #       config:
 #         default:
 #           connectTimeout: 2000
 #           readTimeout: 5000

ERROR o.s.d.r.l.RedisMessageListenerContainer[651][GW] - Connection failure occurred. Restarting subscription task after 5000 ms

解決方案:
最後起來是因爲注掉了redis連接的密碼

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章