ScannerException: while scanning for the next token found character ‘@‘ 问题解决
在把一个老项目修改为动态读取配置参数的时候,发现报了这个错误:
org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
found character ‘@’ that cannot start any token
分析:
产生此问题的原因:
1、一般情况下是因为,配置文件中写错了。请再三检查下项目的maven的pom文件中的 profiles - profile - properties下的属性名。看它是否能够和bootstrap.yml下的spring.profile.active名字是否一致。
很多人出错是因为从网上复制了一个配置,直接丢到了里面。自己不去看下配置项的名是否一致。导致的该错误的产生。
2、IDEA缓存的问题。
处理方法:
pom文件
<profiles><profile><id>dev</dev><properties><!--此处的profileActive的名字是自定义的。这个名字要和bootstrap.yml文件中的spring.profile.active @@包含的值名称一致--><profileActive>local</profileActive></properties><profile>...
</profiles>
bootstrap.yml文件对应
spring:profile:active: @profileActive@ #这个地方的名字要和 pom下的profile下的properties对的上
如果这一步没有问题的话,启动还是报了 '@'的异常的话,一般的情况下,应该是缓存的问题了。
缓存的问题一般你把IDEA右侧的maven,进行一下刷新操作,基本上就可以解决这个问题了。
总结
说个亲身经历,我以前刚上班的时候,公司的技术经理为了图省事,直接从网上copy了一个centos下的MySQL配置文件。然后作为正式环境使用。然后各种数据库的问题,后来一个高级工程师分析了下配置文件,发现配置参数就是普通的PC机的配置,根本就没有发挥服务器的优势。后来调整了缓冲大小。就再也没有问题了。
一般情况下,网络上的东西,其实有很多给出的结果或者答案,只是使用一定的场景,需要你甄别其中的情况,特别是一些配置文件之类的,一般的情况下,如果不是很熟悉,最好把每个配置项都认真读一遍。以防不测。这个不测看具体事故大小而定。
ScannerException: while scanning for the next token found character ‘@‘ 问题解决相关推荐
- org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@‘
一.解析yaml报错 报错信息: Application run failed org.yaml.snakeyaml.scanner.ScannerException: while scanning ...
- org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
问题描述: spring:profiles:active: @activatedProperties@ 在yml读取pom.xml中定义的 profile变量 <profiles>< ...
- 多环境配置的时候报while scanning for the next token found character ‘@‘ that cannot start any token【完全解决方法】
项目需要设置好几个开发环境,于是在pom文件内加入了如下三个生产环境 <!--分别设置开发,本地,生产环境--><profiles><!-- 本地环境 -->< ...
- org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key
org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key 异常: 14:50:33.658 [main] ERR ...
- Expected value but found invalid token at character 1stack traceback:coroutine 0: [C]: in function
local cjson = require("cjson") local data = cjson.decode(res.body) 如果返回的不是json格式,则这段lua脚本会 ...
- Authentication token manipulation error问题解决
某个CentOS 8服务器在使用passwd修改密码时出现错误提示如下: Authentication token manipulation error 提示出现后,退出passwd执行. 故障的发现 ...
- JPA QuerySyntaxException: unexpected token: xxx near问题解决
问题描述: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: salaryDate near line 1, ...
- CSRF token is incorrect 问题解决
问题:CSRF token is incorrect? 输入的用户名和密码都没问题,但就是无法登录 好多博主大佬说更换浏览器,但是我们总共能有几个浏览器呢?3个?8个?总不能每一次都跟换一个吧,根本不 ...
- found character ‘@‘ that cannot start any token. (Do not use @ for indentation)
控制台提示: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found characte ...
最新文章
- html 复选框 mysql_Html:实现带复选框的下拉框(一)
- 全网最简单的dubbo源码调试,建议点赞收藏!!!
- 基本数据类型与表达式2 - 零基础入门学习Delphi03
- dataset中获取图像的名字_GDAL与OpenCV的图像像素读取格式互相转换
- 【存储技术大杂烩】谈谈FC-SAN、IP-SAN、DAS、NAS几种存储技术
- php root 启动,php-fpm如何以root身份启动
- iPad iPhone程序增加和删除启动画面
- 博客开通了,开卷有益,纪念一下
- CCF 送货(满分代码)2015-12-4
- 7.15 HTMl + CSS 笔记整理(一)
- vue 读取ajax数据,详解vue 中使用 AJAX获取数据的方法
- WinError 126 asmjit.dll or one of its dependencies.
- Binder框架在Framework层的C++中的使用
- ios查看帧率的软件_iOS开发-自己写一个实时显示fps帧数的小控件
- php ora01017,使用dblink出现ORA-01017
- JavaSE、JavaEE、JavaME之间的区别
- 人机交互期末复习要点
- 搜狗推送工具之泛站程序实现泛收录
- Learning Puppet — Manifests
- oracle8数据库help文件增长,Oracle 10g 读书笔记