我是第一次单机版的写了一个Kafka程序.先介绍环境:
JDK版本: 1.8.0_101
Spring boot 版本: 2.1.8.RELEASE
Kafka的安装版本: 2.6.0
Spring boot的POM集成Kafka的版本是默认跟spring boot版本(即没有写版本号).
启动报错:
"C:\Program Files\Java\jdk1.8.0_101\bin\java" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=56023 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2017.3\lib\idea_rt.jar=56024:D:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;D:\workspaces\billionvolume\billionvolume-analy\target\classes;D:\maven\repository\org\springframework\boot\spring-boot-starter\2.1.8.RELEASE\spring-boot-starter-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot\2.1.8.RELEASE\spring-boot-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.8.RELEASE\spring-boot-autoconfigure-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.1.8.RELEASE\spring-boot-starter-logging-2.1.8.RELEASE.jar;D:\maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;D:\maven\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;D:\maven\repository\org\slf4j\jul-to-slf4j\1.7.28\jul-to-slf4j-1.7.28.jar;D:\maven\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\maven\repository\org\springframework\spring-core\5.1.9.RELEASE\spring-core-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-jcl\5.1.9.RELEASE\spring-jcl-5.1.9.RELEASE.jar;D:\maven\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;D:\maven\repository\net\bytebuddy\byte-buddy\1.9.16\byte-buddy-1.9.16.jar;D:\maven\repository\org\springframework\kafka\spring-kafka\2.2.8.RELEASE\spring-kafka-2.2.8.RELEASE.jar;D:\maven\repository\org\springframework\spring-context\5.1.9.RELEASE\spring-context-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-aop\5.1.9.RELEASE\spring-aop-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-beans\5.1.9.RELEASE\spring-beans-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-expression\5.1.9.RELEASE\spring-expression-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-messaging\5.1.9.RELEASE\spring-messaging-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-tx\5.1.9.RELEASE\spring-tx-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\retry\spring-retry\1.2.4.RELEASE\spring-retry-1.2.4.RELEASE.jar;D:\maven\repository\org\apache\kafka\kafka-clients\2.0.1\kafka-clients-2.0.1.jar;D:\maven\repository\org\lz4\lz4-java\1.4.1\lz4-java-1.4.1.jar;D:\maven\repository\org\xerial\snappy\snappy-java\1.1.7.1\snappy-java-1.1.7.1.jar;D:\workspaces\billionvolume\billionvolume-framework\target\classes;D:\maven\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;D:\maven\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;D:\maven\repository\org\apache\httpcomponents\httpclient\4.5.9\httpclient-4.5.9.jar;D:\maven\repository\org\apache\httpcomponents\httpcore\4.4.12\httpcore-4.4.12.jar;D:\maven\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\maven\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;D:\maven\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\maven\repository\org\freemarker\freemarker\2.3.29\freemarker-2.3.29.jar;D:\maven\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-data-redis\2.1.8.RELEASE\spring-boot-starter-data-redis-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\data\spring-data-redis\2.1.10.RELEASE\spring-data-redis-2.1.10.RELEASE.jar;D:\maven\repository\org\springframework\data\spring-data-keyvalue\2.1.10.RELEASE\spring-data-keyvalue-2.1.10.RELEASE.jar;D:\maven\repository\org\springframework\data\spring-data-commons\2.1.10.RELEASE\spring-data-commons-2.1.10.RELEASE.jar;D:\maven\repository\org\springframework\spring-oxm\5.1.9.RELEASE\spring-oxm-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-context-support\5.1.9.RELEASE\spring-context-support-5.1.9.RELEASE.jar;D:\maven\repository\io\lettuce\lettuce-core\5.1.8.RELEASE\lettuce-core-5.1.8.RELEASE.jar;D:\maven\repository\io\netty\netty-common\4.1.39.Final\netty-common-4.1.39.Final.jar;D:\maven\repository\io\netty\netty-handler\4.1.39.Final\netty-handler-4.1.39.Final.jar;D:\maven\repository\io\netty\netty-buffer\4.1.39.Final\netty-buffer-4.1.39.Final.jar;D:\maven\repository\io\netty\netty-codec\4.1.39.Final\netty-codec-4.1.39.Final.jar;D:\maven\repository\io\netty\netty-transport\4.1.39.Final\netty-transport-4.1.39.Final.jar;D:\maven\repository\io\netty\netty-resolver\4.1.39.Final\netty-resolver-4.1.39.Final.jar;D:\maven\repository\io\projectreactor\reactor-core\3.2.12.RELEASE\reactor-core-3.2.12.RELEASE.jar;D:\maven\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;D:\maven\repository\redis\clients\jedis\2.9.3\jedis-2.9.3.jar;D:\maven\repository\org\apache\commons\commons-pool2\2.6.2\commons-pool2-2.6.2.jar;D:\maven\repository\com\alibaba\fastjson\1.2.16\fastjson-1.2.16.jar;D:\maven\repository\io\jsonwebtoken\jjwt\0.7.0\jjwt-0.7.0.jar;D:\maven\repository\org\springframework\spring-webmvc\5.1.9.RELEASE\spring-webmvc-5.1.9.RELEASE.jar;D:\maven\repository\org\springframework\spring-web\5.1.9.RELEASE\spring-web-5.1.9.RELEASE.jar;D:\maven\repository\com\alipay\sdk\alipay-sdk-java\3.0.1\alipay-sdk-java-3.0.1.jar;D:\maven\repository\com\aliyun\aliyun-java-sdk-core\3.7.1\aliyun-java-sdk-core-3.7.1.jar;D:\maven\repository\org\json\json\20170516\json-20170516.jar;D:\maven\repository\com\aliyun\aliyun-java-sdk-dysmsapi\1.1.0\aliyun-java-sdk-dysmsapi-1.1.0.jar;D:\maven\repository\com\aliyun\oss\aliyun-sdk-oss\2.8.3\aliyun-sdk-oss-2.8.3.jar;D:\maven\repository\org\jdom\jdom\1.1\jdom-1.1.jar;D:\maven\repository\org\aspectj\aspectjweaver\1.9.4\aspectjweaver-1.9.4.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-websocket\2.1.8.RELEASE\spring-boot-starter-websocket-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-web\2.1.8.RELEASE\spring-boot-starter-web-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-json\2.1.8.RELEASE\spring-boot-starter-json-2.1.8.RELEASE.jar;D:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.9\jackson-datatype-jdk8-2.9.9.jar;D:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.9\jackson-datatype-jsr310-2.9.9.jar;D:\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.9\jackson-module-parameter-names-2.9.9.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.8.RELEASE\spring-boot-starter-tomcat-2.1.8.RELEASE.jar;D:\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.24\tomcat-embed-core-9.0.24.jar;D:\maven\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.24\tomcat-embed-el-9.0.24.jar;D:\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.24\tomcat-embed-websocket-9.0.24.jar;D:\maven\repository\org\hibernate\validator\hibernate-validator\6.0.17.Final\hibernate-validator-6.0.17.Final.jar;D:\maven\repository\org\jboss\logging\jboss-logging\3.3.3.Final\jboss-logging-3.3.3.Final.jar;D:\maven\repository\org\springframework\spring-websocket\5.1.9.RELEASE\spring-websocket-5.1.9.RELEASE.jar;D:\maven\repository\bcprov\bcprov\1.46\bcprov-1.46.jar;D:\maven\repository\okhttp\okhttp\3.10.0\okhttp-3.10.0.jar;D:\maven\repository\okio\okio\1.14.1\okio-1.14.1.jar;D:\maven\repository\net\sf\json-lib\json-lib\2.4\json-lib-2.4-jdk15.jar;D:\maven\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;D:\maven\repository\net\sf\ezmorph\ezmorph\1.0.6\ezmorph-1.0.6.jar;D:\maven\repository\org\ansj\ansj_seg\5.1.1\ansj_seg-5.1.1.jar;D:\maven\repository\org\nlpcn\nlp-lang\1.7.2\nlp-lang-1.7.2.jar;D:\maven\repository\org\apache\poi\poi\3.8\poi-3.8.jar;D:\maven\repository\org\apache\poi\poi-ooxml\3.8\poi-ooxml-3.8.jar;D:\maven\repository\org\apache\poi\poi-ooxml-schemas\3.8\poi-ooxml-schemas-3.8.jar;D:\maven\repository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar;D:\maven\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\maven\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;D:\maven\repository\net\sourceforge\htmlunit\htmlunit\2.36.0\htmlunit-2.36.0.jar;D:\maven\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar;D:\maven\repository\xalan\serializer\2.7.2\serializer-2.7.2.jar;D:\maven\repository\org\apache\commons\commons-text\1.7\commons-text-1.7.jar;D:\maven\repository\org\apache\httpcomponents\httpmime\4.5.9\httpmime-4.5.9.jar;D:\maven\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.36.0\htmlunit-core-js-2.36.0.jar;D:\maven\repository\net\sourceforge\htmlunit\neko-htmlunit\2.36.0\neko-htmlunit-2.36.0.jar;D:\maven\repository\xerces\xercesImpl\2.12.0\xercesImpl-2.12.0.jar;D:\maven\repository\net\sourceforge\htmlunit\htmlunit-cssparser\1.5.0\htmlunit-cssparser-1.5.0.jar;D:\maven\repository\commons-net\commons-net\3.6\commons-net-3.6.jar;D:\maven\repository\org\brotli\dec\0.1.2\dec-0.1.2.jar;D:\maven\repository\org\eclipse\jetty\websocket\websocket-client\9.4.19.v20190610\websocket-client-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\jetty-client\9.4.19.v20190610\jetty-client-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\jetty-http\9.4.19.v20190610\jetty-http-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\jetty-xml\9.4.19.v20190610\jetty-xml-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\jetty-util\9.4.19.v20190610\jetty-util-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\jetty-io\9.4.19.v20190610\jetty-io-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\websocket\websocket-common\9.4.19.v20190610\websocket-common-9.4.19.v20190610.jar;D:\maven\repository\org\eclipse\jetty\websocket\websocket-api\9.4.19.v20190610\websocket-api-9.4.19.v20190610.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\2.1.2.RELEASE\spring-cloud-starter-netflix-eureka-client-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-starter\2.1.2.RELEASE\spring-cloud-starter-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-context\2.1.2.RELEASE\spring-cloud-context-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\security\spring-security-crypto\5.1.6.RELEASE\spring-security-crypto-5.1.6.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-commons\2.1.2.RELEASE\spring-cloud-commons-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;D:\maven\repository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;D:\maven\repository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-netflix-hystrix\2.1.2.RELEASE\spring-cloud-netflix-hystrix-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.1.2.RELEASE\spring-cloud-netflix-eureka-client-2.1.2.RELEASE.jar;D:\maven\repository\com\netflix\eureka\eureka-client\1.9.12\eureka-client-1.9.12.jar;D:\maven\repository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\maven\repository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\maven\repository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\maven\repository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\maven\repository\joda-time\joda-time\2.10.3\joda-time-2.10.3.jar;D:\maven\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\maven\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\maven\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\maven\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\maven\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\maven\repository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\maven\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\maven\repository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\maven\repository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\maven\repository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\maven\repository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\maven\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\maven\repository\javax\inject\javax.inject\1\javax.inject-1.jar;D:\maven\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\maven\repository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\maven\repository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\maven\repository\com\netflix\eureka\eureka-core\1.9.12\eureka-core-1.9.12.jar;D:\maven\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar;D:\maven\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.1.2.RELEASE\spring-cloud-starter-netflix-archaius-2.1.2.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-netflix-archaius\2.1.2.RELEASE\spring-cloud-netflix-archaius-2.1.2.RELEASE.jar;D:\maven\repository\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.1.2.RELEASE\spring-cloud-starter-netflix-ribbon-2.1.2.RELEASE.jar;D:\maven\repository\com\netflix\ribbon\ribbon\2.3.0\ribbon-2.3.0.jar;D:\maven\repository\com\netflix\ribbon\ribbon-transport\2.3.0\ribbon-transport-2.3.0.jar;D:\maven\repository\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\maven\repository\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\maven\repository\com\netflix\hystrix\hystrix-core\1.4.3\hystrix-core-1.4.3.jar;D:\maven\repository\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\maven\repository\com\netflix\ribbon\ribbon-core\2.3.0\ribbon-core-2.3.0.jar;D:\maven\repository\com\netflix\ribbon\ribbon-httpclient\2.3.0\ribbon-httpclient-2.3.0.jar;D:\maven\repository\com\netflix\netflix-commons\netflix-commons-util\0.1.1\netflix-commons-util-0.1.1.jar;D:\maven\repository\com\netflix\ribbon\ribbon-loadbalancer\2.3.0\ribbon-loadbalancer-2.3.0.jar;D:\maven\repository\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\maven\repository\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;D:\maven\repository\com\netflix\ribbon\ribbon-eureka\2.3.0\ribbon-eureka-2.3.0.jar;D:\maven\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\maven\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\maven\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\maven\repository\io\springfox\springfox-swagger2\2.7.0\springfox-swagger2-2.7.0.jar;D:\maven\repository\io\swagger\swagger-annotations\1.5.13\swagger-annotations-1.5.13.jar;D:\maven\repository\io\swagger\swagger-models\1.5.13\swagger-models-1.5.13.jar;D:\maven\repository\io\springfox\springfox-spi\2.7.0\springfox-spi-2.7.0.jar;D:\maven\repository\io\springfox\springfox-core\2.7.0\springfox-core-2.7.0.jar;D:\maven\repository\io\springfox\springfox-schema\2.7.0\springfox-schema-2.7.0.jar;D:\maven\repository\io\springfox\springfox-swagger-common\2.7.0\springfox-swagger-common-2.7.0.jar;D:\maven\repository\io\springfox\springfox-spring-web\2.7.0\springfox-spring-web-2.7.0.jar;D:\maven\repository\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;D:\maven\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\maven\repository\org\slf4j\slf4j-api\1.7.28\slf4j-api-1.7.28.jar;D:\maven\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\maven\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\maven\repository\org\mapstruct\mapstruct\1.1.0.Final\mapstruct-1.1.0.Final.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-openfeign-core\2.1.0.RELEASE\spring-cloud-openfeign-core-2.1.0.RELEASE.jar;D:\maven\repository\org\springframework\cloud\spring-cloud-netflix-ribbon\2.1.0.RELEASE\spring-cloud-netflix-ribbon-2.1.0.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-aop\2.1.8.RELEASE\spring-boot-starter-aop-2.1.8.RELEASE.jar;D:\maven\repository\io\github\openfeign\form\feign-form-spring\3.5.0\feign-form-spring-3.5.0.jar;D:\maven\repository\io\github\openfeign\form\feign-form\3.5.0\feign-form-3.5.0.jar;D:\maven\repository\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;D:\maven\repository\com\github\xiaoymin\swagger-bootstrap-ui\1.8.1\swagger-bootstrap-ui-1.8.1.jar;D:\maven\repository\io\springfox\springfox-swagger-ui\2.7.0\springfox-swagger-ui-2.7.0.jar;D:\maven\repository\com\baomidou\mybatisplus-spring-boot-starter\1.0.5\mybatisplus-spring-boot-starter-1.0.5.jar;D:\maven\repository\org\springframework\boot\spring-boot-configuration-processor\2.1.8.RELEASE\spring-boot-configuration-processor-2.1.8.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-jdbc\2.1.8.RELEASE\spring-boot-starter-jdbc-2.1.8.RELEASE.jar;D:\maven\repository\com\zaxxer\HikariCP\3.2.0\HikariCP-3.2.0.jar;D:\maven\repository\org\springframework\spring-jdbc\5.1.9.RELEASE\spring-jdbc-5.1.9.RELEASE.jar;D:\maven\repository\com\baomidou\mybatis-plus\2.1.4\mybatis-plus-2.1.4.jar;D:\maven\repository\org\mybatis\mybatis-spring\1.3.1\mybatis-spring-1.3.1.jar;D:\maven\repository\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;D:\maven\repository\com\github\jsqlparser\jsqlparser\1.1\jsqlparser-1.1.jar;D:\maven\repository\mysql\mysql-connector-java\5.1.41\mysql-connector-java-5.1.41.jar;D:\maven\repository\commons-io\commons-io\2.5\commons-io-2.5.jar;D:\maven\repository\com\belerweb\pinyin4j\2.5.1\pinyin4j-2.5.1.jar;D:\maven\repository\org\apache\commons\commons-collections4\4.1\commons-collections4-4.1.jar;D:\maven\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;D:\maven\repository\cglib\cglib\3.2.4\cglib-3.2.4.jar;D:\maven\repository\org\ow2\asm\asm\5.1\asm-5.1.jar;D:\maven\repository\org\apache\ant\ant\1.9.6\ant-1.9.6.jar;D:\maven\repository\org\apache\ant\ant-launcher\1.9.6\ant-launcher-1.9.6.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-core\2.9.5\jackson-core-2.9.5.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.5\jackson-annotations-2.9.5.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.9.5\jackson-databind-2.9.5.jar;D:\maven\repository\net\logstash\logback\logstash-logback-encoder\4.11\logstash-logback-encoder-4.11.jar;D:\maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\maven\repository\com\google\guava\guava\20.0\guava-20.0.jar;D:\maven\repository\ma\glasnost\orika\orika-core\1.5.1\orika-core-1.5.1.jar;D:\maven\repository\org\javassist\javassist\3.19.0-GA\javassist-3.19.0-GA.jar;D:\maven\repository\com\thoughtworks\paranamer\paranamer\2.8\paranamer-2.8.jar;D:\maven\repository\com\googlecode\concurrentlinkedhashmap\concurrentlinkedhashmap-lru\1.4.2\concurrentlinkedhashmap-lru-1.4.2.jar;D:\maven\repository\com\carrotsearch\java-sizeof\0.0.4\java-sizeof-0.0.4.jar;D:\maven\repository\org\codehaus\janino\janino\3.0.15\janino-3.0.15.jar;D:\maven\repository\org\codehaus\janino\commons-compiler\3.0.15\commons-compiler-3.0.15.jar;D:\maven\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\maven\repository\com\github\pagehelper\pagehelper\4.1.1\pagehelper-4.1.1.jar;D:\maven\repository\org\dom4j\dom4j\2.1.1\dom4j-2.1.1.jar;D:\maven\repository\eu\bitwalker\UserAgentUtils\1.21\UserAgentUtils-1.21.jar" cn.billionvolume.analy.AnalyApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.8.RELEASE)
2020-09-16 17:54:38 [main] INFO cn.billionvolume.analy.AnalyApplication - No active profile set, falling back to default profiles: default
2020-09-16 17:54:39 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
2020-09-16 17:54:39 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.24]
2020-09-16 17:54:39 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2020-09-16 17:54:40 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2020-09-16 17:54:40 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2020-09-16 17:54:41 [main] INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2020-09-16 17:54:41 [main] WARN com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2020-09-16 17:54:41 [main] INFO com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-09-16 17:54:41 [main] WARN com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2020-09-16 17:54:41 [main] INFO com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-09-16 17:54:44 [main] INFO com.netflix.discovery.DiscoveryClient - Initializing Eureka in region us-east-1
2020-09-16 17:54:44 [main] INFO com.netflix.discovery.DiscoveryClient - Client configured to neither register nor query for data.
2020-09-16 17:54:44 [main] INFO com.netflix.discovery.DiscoveryClient - Discovery Client initialized at timestamp 1600250084203 with initial instances count: 0
2020-09-16 17:54:44 [main] INFO org.apache.kafka.clients.consumer.ConsumerConfig - ConsumerConfig values:
auto.commit.interval.ms = 100
auto.offset.reset = earliest
bootstrap.servers = [192.138.2.231:9092]
check.crcs = true
client.id =
connections.max.idle.ms = 540000
default.api.timeout.ms = 60000
enable.auto.commit = true
exclude.internal.topics = true
fetch.max.bytes = 52428800
fetch.max.wait.ms = 500
fetch.min.bytes = 1
group.id = kafka-test
heartbeat.interval.ms = 3000
interceptor.classes = []
internal.leave.group.on.close = true
isolation.level = read_uncommitted
key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
max.partition.fetch.bytes = 1048576
max.poll.interval.ms = 300000
max.poll.records = 500
metadata.max.age.ms = 300000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
receive.buffer.bytes = 65536
reconnect.backoff.max.ms = 1000
reconnect.backoff.ms = 50
request.timeout.ms = 30000
retry.backoff.ms = 100
sasl.client.callback.handler.class = null
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.login.callback.handler.class = null
sasl.login.class = null
sasl.login.refresh.buffer.seconds = 300
sasl.login.refresh.min.period.seconds = 60
sasl.login.refresh.window.factor = 0.8
sasl.login.refresh.window.jitter = 0.05
sasl.mechanism = GSSAPI
security.protocol = PLAINTEXT
send.buffer.bytes = 131072
session.timeout.ms = 10000
ssl.cipher.suites = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
ssl.endpoint.identification.algorithm = https
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.protocol = TLS
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer
2020-09-16 17:54:44 [main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka version : 2.0.1
2020-09-16 17:54:44 [main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka commitId : fa14705e51bd2ce5
2020-09-16 17:55:05 [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-1, groupId=kafka-test] Connection to node -1 could not be established. Broker may not be available.
2020-09-16 17:55:26 [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-1, groupId=kafka-test] Connection to node -1 could not be established. Broker may not be available.
2020-09-16 17:55:44 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata
2020-09-16 17:55:44 [main] INFO com.netflix.discovery.DiscoveryClient - Shutting down DiscoveryClient ...
2020-09-16 17:55:44 [main] INFO com.netflix.discovery.DiscoveryClient - Completed shut down of DiscoveryClient
2020-09-16 17:55:44 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2020-09-16 17:55:44 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
2020-09-16 17:55:44 [main] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat]
2020-09-16 17:55:44 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
at cn.billionvolume.analy.AnalyApplication.main(AnalyApplication.java:24)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata
Process finished with exit code 1
看上面的日志,都打印出来Kafka的版本了.还以为连接上.就没注意配置:
原配置:
spring.kafka.bootstrapServers=192.138.2.231:9092
#生产者配置,参见org.springframework.boot.autoconfigure.kafka.KafkaProperties.Producer
spring.kafka.producer.retries=0
# 每次批量发送消息的数量
spring.kafka.producer.batchSize=16384
spring.kafka.producer.bufferMemory=33554432
# 指定消息key和消息体的编解码方式
spring.kafka.producer.keySerializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.valueSerializer=org.apache.kafka.common.serialization.StringSerializer
#消费者配置,参见org.springframework.boot.autoconfigure.kafka.KafkaProperties.Consumer
spring.kafka.consumer.groupId=kafka-test
spring.kafka.consumer.autoOffsetReset=earliest
spring.kafka.consumer.enableAutoCommit=true
spring.kafka.consumer.autoCommitInterval=100
# 指定消息key和消息体的编解码方式
spring.kafka.consumer.keyDeserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.valueDeserializer=org.apache.kafka.common.serialization.StringDeserializer
其实这个地方我搞错了一个地方: Kafka的安装服务器IP地址写错了. 导致出现这个问题. 修改了一下配置.
spring.kafka.bootstrapServers=192.168.2.231:9092
百度搜索好多的博客.说什么groupId配置有问题.然后各种找groupId怎么配置.最后发现全胡扯.groupId是自定义的.跟Kafka和Zookeeper里面的配置扯不上边.
启动可以了.但是又出现了一个WARN的日志信息:
org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-1,
org.apache.kafka.clients.networkclient broker may not be available
这样的问题是 Kafka配置没有对外开放Host和Post. Kafka默认的安装包是不对外开放的.这里要修改一下:
修改后重启服务就可以了. 还有些博客说主题要自己创建.这些在新的Kafka里面完全不需要哈.旧的我没试过(具体怎么样我不评价).
主题就是: topic
我就这样配置的:
这里完全不用考虑,我发送一个消息.由于分布式,会在多一个项目里面被消费.不会的啊.亲测排除这种可能.
使用截图:
好了一个Spring boot 集成Kafka功能介绍完毕.
最后补充一下Kafka的集成POM的配置;
网友评论