LogBack的日志报错解决办法 org.xml.sax.SAXNotRecognizedException

报错信息如下:

复制代码
18:00:57,395 |-ERROR in ch.qos.logback.core.joran.event.SaxEventRecorder@48aaecc3 - Error during parser creation or parser configuration org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
   at org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
   at 	at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178)
   at 	at org.gjt.xpp.jaxp11.SAXParserImpl.setFeatures(SAXParserImpl.java:149)
   at 	at org.gjt.xpp.jaxp11.SAXParserImpl.<init>(SAXParserImpl.java:132)
   at 	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:114)
   at 	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:142)
   at 	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:88)
   at 	at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:62)
   at 	at  

原因分析:

  • 从报错日志可以看出是logback的xml日志解析出现问题, 报错相关的类是 org.gjt.xpp.sax2.等相关的类
  • 查找这些类所在的包为 pull-parser , 并且这个包的最新版本都是2005年的,都没有维护
  • 我并没有直接引入这个包, 继续查找发现是阿里云的SDK引入的老版本的dom4j包, dom4j再引入这个包导致的问题。
  • SDK被其他项目使用,最好做到少依赖,不依赖第三方包和过期包。 垃圾阿里云

解决办法

  1. 现在阿里云的SDK访问的接口也全部都是application/json的格式了, 并且我也没有使用到xml格式
  2. 我尝试直接排除依赖 pull-parser, 启动项目成功, 运行后也正常。
  3. 阿里对外提供的SDK真的是垃圾, 基本的依赖都没有清理好
相关推荐
寒士obj20 小时前
熟悉并使用Spring框架 - XML篇
xml·java·spring
Arva .1 天前
Spring基于XML的自动装配
xml·java·spring
fatfishccc2 天前
循序渐进学 Spring (上):从 IoC/DI 核心原理到 XML 配置实战
xml·java·数据库·spring·intellij-idea·ioc·di
fatfishccc6 天前
【MyBatis新手避坑】详解 `Could not find resource ...Mapper.xml` 错误
xml·intellij-idea·mybatis
helloworld工程师6 天前
Dubbo应用开发之基于xml的第一个Dubbo程序
xml·dubbo·safari
coding随想8 天前
DOM的XML命名空间革命:从混乱到有序的蜕变
xml
真实的菜8 天前
MyBatis核心配置深度解析:从XML到映射的完整技术指南
xml·tomcat·mybatis
创客家9 天前
生成网站sitemap.xml地图教程
xml
qq_589568109 天前
idea中.xml文件的块注释快捷键
xml·java·intellij-idea
一杯科技拿铁10 天前
从 XML 到 JSON,再到 CBOR:数据交换格式的演进之路
xml·json