blade项目用java -jar的方式启动报错

Blade 未结 2 2956
xfwangkai
xfwangkai 2019-11-04 10:34

一、该问题的重现步骤是什么?

1. 所有项目已打成jar包,在用java -jar xxx.jar启动服务的时候报错:parse data from Nacos error, dataId:blade.yaml, data:......

2. 

3.


二、你期待的结果是什么?实际看到的又是什么?

希望可以正确在服务器上启动各个项目


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

blade开源版本2.5.2,在windows系统上


四、请提供详细的错误堆栈信息,这很重要。

2019-11-04 10:25:53.917 ERROR 6816 --- [           main] c.a.c.n.c.NacosProperty
SourceBuilder     : parse data from Nacos error,dataId:blade.yaml,data:#服务器配

server:
  undertow:
    # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核
心一个线程
    io-threads: 4
    # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取
得线程,它的值设置取决于系统的负载
    worker-threads: 20
    # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的
池化内存管理
    buffer-size: 1024
    # 是否分配的直接内存
    direct-buffers: true

#spring配置
spring:
  devtools:
    restart:
      log-condition-evaluation-delta: false
    livereload:
      port: 23333

#feign配置
feign:
  hystrix:
    enabled: true
  #sentinel:
    #enabled: true
  okhttp:
    enabled: true
  httpclient:
    enabled: false

#hystrix配置
hystrix:
  threadpool:
    default:
      coreSize: 300
      maxQueueSize: 1000
      queueSizeRejectionThreshold: 800
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 5000

#ribbon配置
ribbon:
  #对当前实例的重试次数
  MaxAutoRetries: 1
  #切换实例的重试次数
  MaxAutoRetriesNextServer: 2
  #请求处理的超时时间
  ReadTimeout: 60000
  #请求连接的超时时间
  ConnectTimeout: 60000
  #对所有操作请求都进行重试
  OkToRetryOnAllOperations: true

#对外暴露端口
management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: always

#blade配置
blade:
  xss:
    url:
      exclude-patterns:
        - /weixin
  secure:
    skip-url:
        - /test/**
  client:
    - client-id: sword
      path-patterns:
        - /sword/**
    - client-id: saber
      path-patterns:
        - /saber/**
  tenant:
    column: tenant_id
    tables:
      - blade_notice,

org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException
: Input length = 1
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.
java:176) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.
java:171) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) ~[
snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.ja
va:1177) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
va:287) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:22
7) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produ
ce(ParserImpl.java:195) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~
[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.composer.Composer.checkNode(Composer.java:72) ~[sn
akeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.constructor.BaseConstructor.checkData(BaseConstruc
tor.java:112) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.Yaml$1.hasNext(Yaml.java:542) ~[snakeyaml-1.23.jar
!/:na]
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlPr
ocessor.java:160) ~[spring-beans-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlPr
ocessor.java:134) ~[spring-beans-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.cr
eateProperties(YamlPropertiesFactoryBean.java:135) ~[spring-beans-5.1.9.RELEASE.
jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.ge
tObject(YamlPropertiesFactoryBean.java:115) ~[spring-beans-5.1.9.RELEASE.jar!/:5
.1.9.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosDa
ta(NacosPropertySourceBuilder.java:100) [spring-cloud-alibaba-nacos-config-2.1.0
.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(Nacos
PropertySourceBuilder.java:75) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.
jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDa
taIfPresent(NacosPropertySourceLocator.java:179) [spring-cloud-alibaba-nacos-con
fig-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadApplica
tionConfiguration(NacosPropertySourceLocator.java:155) [spring-cloud-alibaba-nac
os-config-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(Naco
sPropertySourceLocator.java:88) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE
.jar!/:2.1.0.RELEASE]
        at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapCon
figuration.initialize(PropertySourceBootstrapConfiguration.java:97) [spring-clou
d-context-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
        at org.springframework.boot.SpringApplication.applyInitializers(SpringAp
plication.java:623) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.prepareContext(SpringAppli
cation.java:367) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:311) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringA
pplicationBuilder.java:140) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springblade.core.launch.BladeApplication.run(BladeApplication.jav
a:49) [blade-core-launch-2.5.2.jar!/:na]
        at org.springblade.auth.AuthApplication.main(AuthApplication.java:34) [c
lasses!/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
0_191]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.
0_191]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:
1.8.0_191]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner
.java:48) [blade-auth.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [bl
ade-auth.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [bl
ade-auth.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
 [blade-auth.jar:na]
Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.nio.charset.CoderResult.throwException(Unknown Source) ~[na:1.8.
0_191]
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[na:1.8.0_191]
        at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[na:1.8.0_191]
        at java.io.InputStreamReader.read(Unknown Source) ~[na:1.8.0_191]
        at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183)
~[snakeyaml-1.23.jar!/:na]
        ... 36 common frames omitted

2019-11-04 10:25:53.942  INFO 6816 --- [           main] c.a.c.n.c.NacosProperty
SourceBuilder     : Loading nacos data, dataId: 'blade-dev.yaml', group: 'DEFAUL
T_GROUP'
2019-11-04 10:25:53.943 ERROR 6816 --- [           main] c.a.c.n.c.NacosProperty
SourceBuilder     : parse data from Nacos error,dataId:blade-dev.yaml,data:#spri
ng配置
spring:
  redis:
    ##redis 单机环境配置
    host: 127.0.0.1
    port: 6379
    password:
    database: 0
    ssl: false
    ##redis 集群环境配置
    #cluster:
    #  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003
    #  commandTimeout: 5000

#项目模块集中配置
blade:
  #通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
  datasource:
    dev:
      url: jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&charac
terEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=tru
e&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT+8
      username: root
      password: Passw0rd
,

org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException
: Input length = 1
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.
java:176) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.
java:171) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) ~[
snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.ja
va:1177) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
va:287) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:22
7) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produ
ce(ParserImpl.java:195) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~
[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.composer.Composer.checkNode(Composer.java:72) ~[sn
akeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.constructor.BaseConstructor.checkData(BaseConstruc
tor.java:112) ~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.Yaml$1.hasNext(Yaml.java:542) ~[snakeyaml-1.23.jar
!/:na]
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlPr
ocessor.java:160) ~[spring-beans-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlPr
ocessor.java:134) ~[spring-beans-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.cr
eateProperties(YamlPropertiesFactoryBean.java:135) ~[spring-beans-5.1.9.RELEASE.
jar!/:5.1.9.RELEASE]
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.ge
tObject(YamlPropertiesFactoryBean.java:115) ~[spring-beans-5.1.9.RELEASE.jar!/:5
.1.9.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosDa
ta(NacosPropertySourceBuilder.java:100) [spring-cloud-alibaba-nacos-config-2.1.0
.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(Nacos
PropertySourceBuilder.java:75) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.
jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDa
taIfPresent(NacosPropertySourceLocator.java:179) [spring-cloud-alibaba-nacos-con
fig-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadApplica
tionConfiguration(NacosPropertySourceLocator.java:159) [spring-cloud-alibaba-nac
os-config-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(Naco
sPropertySourceLocator.java:88) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE
.jar!/:2.1.0.RELEASE]
        at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapCon
figuration.initialize(PropertySourceBootstrapConfiguration.java:97) [spring-clou
d-context-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
        at org.springframework.boot.SpringApplication.applyInitializers(SpringAp
plication.java:623) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.prepareContext(SpringAppli
cation.java:367) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:311) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringA
pplicationBuilder.java:140) [spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springblade.core.launch.BladeApplication.run(BladeApplication.jav
a:49) [blade-core-launch-2.5.2.jar!/:na]
        at org.springblade.auth.AuthApplication.main(AuthApplication.java:34) [c
lasses!/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
0_191]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.
0_191]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:
1.8.0_191]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner
.java:48) [blade-auth.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [bl
ade-auth.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [bl
ade-auth.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
 [blade-auth.jar:na]
Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.nio.charset.CoderResult.throwException(Unknown Source) ~[na:1.8.
0_191]
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[na:1.8.0_191]
        at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[na:1.8.0_191]
        at java.io.InputStreamReader.read(Unknown Source) ~[na:1.8.0_191]
        at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125)
~[snakeyaml-1.23.jar!/:na]
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183)
~[snakeyaml-1.23.jar!/:na]
        ... 36 common frames omitted


五、若有更多详细信息,请在下面提供。



2条回答
  •  admin
    admin (楼主)
    2019-11-04 10:38

    windows启动,会有字符集问题,需要把nacos配置文件的中文注释都删掉

提交回复