-
Choerodon平台版本:0.6.0
-
运行环境(如localhost或k8s):localhost
-
遇到问题时的前置条件:
-
问题描述:
Choerodon后端小白一只,只是想先搭一个SpringBoot的demo先跑起来。克隆了新建的项目,先把有关的插件先注释了,但是启动还是报错
先在pom文件里修改了版本,进行了重新构建
然后在application里面注释掉了插件有关的
# application.yml
spring:
# sleuth:
# integration:
# enabled: false
# scheduled:
# enabled: false
# sampler:
# percentage: 1.0
# stream:
# enabled: true
datasource:
url: jdbc:mysql://localhost:3306/demo_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: root
# kafka: #使用原生spring kafka需要配置
# bootstrap-servers: localhost:9092
# consumer:
# group-id: iam-service
# auto-offset-reset: earliest
# cloud:
# bus:
# enabled: true
# stream:
# kafka:
# binder:
# brokers: 127.0.0.1:9092
# zkNodes: 127.0.0.1:2181
#event:
# store:
# service:
# name: event-store-service
#choerodon:
# ldap:
# userNameType: 0
# devops:
# message: true
# event:
# consumer:
# enabled: true # 是否开启,不设置默认开启
# queue-type: kafka # 消息队列类型,目前仅支持kafka
# enable-duplicate-remove: true # 是否开启去重功能
# failed-strategy: nothing # 消息失败策略
# retry:
# enabled: true # 是否开启重试功能
# kafka:
# bootstrap-servers: localhost:9092
eureka:
instance:
preferIpAddress: true
leaseRenewalIntervalInSeconds: 10
leaseExpirationDurationInSeconds: 30
metadata-map:
VERSION: v1
client:
serviceUrl:
defaultZone: http://localhost:8000/eureka/
registryFetchIntervalSeconds: 10
#hystrix:
# command:
# default:
# execution:
# isolation:
# thread:
# timeoutInMilliseconds: 15000
# stream:
# queue:
# enabled: false
#ribbon:
# ReadTimeout: 5000
# ConnectTimeout: 5000
#file-service:
# ribbon:
# ReadTimeout: 15000
# ConnectTimeout: 15000
mybatis:
mapperLocations: classpath*:/mapper/*.xml
configuration: # 数据库下划线转驼峰配置
mapUnderscoreToCamelCase: true
在values.yaml中注释了kafka相关的
# Default values for manager-service.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: registry.cn-hangzhou.aliyuncs.com/ora-xadc/xa-todo-servie
pullPolicy: Always
preJob:
preConfig:
configFile: application.yml
mysql:
host: 192.168.12.175
port: 3306
database: manager_service
username: root
password: choerodon
preInitDB:
mysql:
host: 192.168.12.175
port: 3306
database: demo_service
username: root
password: choerodon
deployment:
managementPort: 18088
env:
open:
## register-server
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://register-server.io-choerodon:8000/eureka/
## config-server
SPRING_CLOUD_CONFIG_ENABLED: true
SPRING_CLOUD_CONFIG_URI: http://config-server.framework:8010/
## mysql
SPRING_DATASOURCE_URL: jdbc:mysql://localhost/demo_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: choerodon
## kafka
# CHOERODON_EVENT_CONSUMER_KAFKA_BOOTSTRAP_SERVERS: kafka-0.kafka-headless.kafka.svc.cluster.local:9092,kafka-1.kafka-headless.kafka.svc.cluster.local:9092,kafka-2.kafka-headless.kafka.svc.cluster.local:9092
# SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS: kafka-0.kafka-headless.kafka.svc.cluster.local:9092,kafka-1.kafka-headless.kafka.svc.cluster.local:9092,kafka-2.kafka-headless.kafka.svc.cluster.local:9092
# SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODES: zookeeper-0.zookeeper-headless.zookeeper.svc.cluster.local:2181,zookeeper-1.zookeeper-headless.zookeeper.svc.cluster.local:2181,zookeeper-2.zookeeper-headless.zookeeper.svc.cluster.local:2181
# SPRING_KAFKA_PRODUCER_VALUE_SERIALIZER: org.apache.kafka.common.serialization.ByteArraySerializer
metrics:
path: /prometheus
group: spring-boot
logs:
parser: spring-boot
persistence:
enabled: false
## A manually managed Persistent Volume and Claim
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
# existingClaim:
# subPath:
service:
enabled: false
type: ClusterIP
port: 18080
ingress:
enabled: false
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources,such as Minikube. If you do want to specify resources,uncomment the following
# lines,adjust them as necessary,and remove the curly braces after ‘resources:’.
limits:
# cpu: 100m
memory: 2Gi
requests:
# cpu: 100m
memory: 1.5Gi
由于在跑的时候有提示18081端口已被占用,所以我改成18088了
注释了demo类中的引用
报了zookeeper连接异常的错误
2018-08-28 22:49:20.573 INFO [xa-todo-servie,] 1948 — [0:0:0:0:1:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-08-28 22:49:21.581 WARN [xa-todo-servie,] 1948 — [0:0:0:0:1:2181)] org.apache.zookeeper.ClientCnxn : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_77]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_77]
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[zookeeper-3.4.8.jar:3.4.8–1]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) ~[zookeeper-3.4.8.jar:3.4.8–1]
-
原因分析:
报了zookeeper连接异常的错误,因为我的kafka装在虚拟机的docker中,暂时没有连接,demo是本地跑的。所以我想注释了插件,先把demo跑通,我只是想先跑通demo啊
-
疑问:
提出您对于遇到和解决该问题时的疑问