一、异常信息

Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:)
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@: - no applicable action for [charset], current ElementPath is [[configuration][appender][encoder][charset]]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:)
at org.springframework.context.support.DefaultLifecycleProcessor.access$(DefaultLifecycleProcessor.java:)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.zbq.user.ZbqUserApplication.main(ZbqUserApplication.java:)
... more
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@: - no applicable action for [charset], current ElementPath is [[configuration][appender][encoder][charset]]
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:)
at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:)
at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:)
at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:)
at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:)
at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:)
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:)
at java.util.Iterator.forEachRemaining(Iterator.java:)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:)
at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:)
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:)
... more
Caused by: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@: - no applicable action for [charset], current ElementPath is [[configuration][appender][encoder][charset]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:)
... more

二、原因分析

从异常信息no applicable action for [charset]可以看出,是因为charset标签不可用导致,可能是logback版本的原因。

我的配置是这样的,存在charset标签:

    <!-- ALL -->
<appender name="FILE-ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--日志文件的路径及文件名-->
<!--被写入的文件名,可以是相对目录,也可以是绝对目录,如果上级目录不存在会自动创建,没有默认值-->
<file>${logback.path}/${application.name}-all.log</file>
<!-- 如果 true,事件被追加到现存文件尾部。如果 false,清空现存文件.默认为 true -->
<append>true</append>
<!--临界值过滤器,过滤掉低于指定临界值的日志。当日志级别等于或高于临界值时,过滤器返回NEUTRAL;当日志级别低于临界值时,日志会被拒绝-->
<!-- 此日志文件只记录INFO级别的 -->
<!--<filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
<!--<level>INFO</level>-->
<!--</filter>-->
<!--当发生滚动时,决定 RollingFileAppender 的行为-->
<!--日志记录器的滚动策略,按日期,按大小记录,涉及文件移动和重命名-->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,例如今天是2018--21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
而2018--21的归档日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<!--即file和fileNamePattern同时制定,当天日志名由file决定,前一天的文件名将自动改为fileNamePattern的值-->
<!-- 若要加一层时间目录 <fileNamePattern>${logback.path}/%d{yyyy-MM-dd,aux}/${logback.info.filename}.%i.log</fileNamePattern>-->
<!--<fileNamePattern>${logback.path}/${application.name}-info.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>-->
<fileNamePattern>${logback.path}/${application.name}-all.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<!--控制被保留的归档文件的最大数量,超出数量就删除旧文件-->
<!--日志文件保留天数 -->
<maxHistory>${logback.max-history}</maxHistory>
<!--指定文件的大小-->
<maxFileSize>${logback.max-file-size}</maxFileSize>
</rollingPolicy>
<!--负责两件事,一是把日志信息转换成字节数组,二是把字节数组写入到输出流-->
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>${logback.file-pattern}</pattern>
<!--日志字符编码格式-->
<charset>${logback.charset}</charset>
</encoder>
</appender>

三、解决方案

将logback配置中,charset标签去掉就可以了

【异常】ERROR in ch.qos.logback.core.joran.spi.Interpreter@159:22 - no applicable action for [charset], current ElementPath is [[configuration][appender][encoder][charset]]的更多相关文章

  1. 报错:ch.qos.logback.core.joran.spi.JoranException

    项目中使用了maven. 1.找到本地仓库,删除ch文件夹 2.对项目执行maven install 3.在更新下项目maven update

  2. java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException

    问题描述:启动tomcat服务器的时候,报找不到JoranException类的异常 原因:tomcat中没有logback-core-1.1.2.jar包 解决方法:在tomcat中的lib目录添加 ...

  3. 解决java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/Pattern

    明明引入了这个,却提示没有 看下面文章: http://www.maocaoying.com/article/109

  4. Logback报错 no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]

    老版本是0.9,移到springboot项目,解决办法,删除xml配置文件节点<Encoding>UTF-8</Encoding>

  5. spring boot 启动报 java.lang.NoClassDefFoundError: ch/qos/logback/core/spi/LifeCycle 错误

    Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: ch/qos ...

  6. Logback新版本报no applicable action for [Encoding]问题

    logback.xml配置文件如下: <?xml version="1.0" encoding="UTF-8"?> <configuratio ...

  7. java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法

    一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...

  8. org.slf4j.impl.Log4jLoggerAdapter cannot be cast to ch.qos.logback.classic.Logger

    https://stackoverflow.com/questions/31433246/classcastexception-org-slf4j-impl-log4jloggeradapter-ca ...

  9. 解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level

    解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level 学习了:https://blog.csdn. ...

随机推荐

  1. T1 :最小值(min)题解 ——2019.10.15

    思路: 对于 % 30 的数据,可以想到一个 Dp 方程: 其中dp[i]表示分割[1,i]的最大答案 代码: #include<cstdio> #include<cstring&g ...

  2. 【cf比赛记录】Educational Codeforces Round 77 (Rated for Div. 2)

    比赛传送门 这场题目前三题看得挺舒服的,没有臃肿的题目,对于我这种英语渣渣就非常友好,但因为太急了,wa了两发A后才意识到用模拟(可以删了,博主真的是个菜鸟),结果导致心态大崩 ---- 而且也跟最近 ...

  3. Redis常见场景解析

    一 前言 Redis是一个key-value存储系统,现在在各种系统中的使用越来越多,大部分情况下是因为其高性能的特性,被当做缓存使用,这里介绍下Redis经常遇到的使用场景. 二 Redis特性 一 ...

  4. FCB CCB FileObject

    CCB  ContextControlBlock  是存Private信息的,这个FO的特殊信息 FCB  FileControlBlock          是存全局信息的 FO    FileOb ...

  5. Java并发之多线程下竞态条件概念的理解

    一.简述 竞态条件(Race Condition):计算的正确性取决于多个线程的交替执行时序时,就会发生竞态条件. 二.常见竞态条件分析 最常见的竞态条件为 1.先检测后执行 执行依赖于检测的结果,而 ...

  6. 连上Microbit板

    我们是在自己电脑上,用Mu编程,最终程序要烧录到Microbi板子的控制芯片中去,还记得这款芯片是哪家公司生产的?是多少位的?呵呵. 因此,我们要把板子和电脑连起来,用常见的一大一小的USB线就可以了 ...

  7. day61——多表操作(增、删除、改、基于对象的跨表查询)

    day61 增删改查 增加 # 增加 # 一对一 # au_obj = models.AuthorDetail.objects.get(id=4) models.Author.objects.crea ...

  8. BZOJ3277 串(后缀自动机)

    对多串建立SAM的一种方法是加分隔符.于是加完分隔符建出SAM. 考虑统计出每个节点被多少个串包含.让每个串各自在SAM上跑,跑到一个节点就标记(显然一定会完全匹配该节点,因为是对包含其的串建的SAM ...

  9. TServerSocket组件

    主要作为服务器端的套接字管理器使用.它封装了服务器端的套接字.在打开套接字后,服务器端就处于监听状态,在接收到其它机器的连接请求后,与客户端建立连接,创建一个新的套接字,用于和客户端互传数据,此时TS ...

  10. CXF 教程(一)

    CXF Web Service 简单示例 1 准备工作 2 第一个例子 3 客户端 3.1 使用 WSDL 生成客户端 4 RPC 风格 5 相关命令介绍 5.1 Java to WS 1 准备工作 ...