解决 Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream 错误
KuCoin Token 中文站
KuCoin Token 中文站

LOCK中文网

解决 Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream 错误

发布日期:2025-01-04 16:17    点击次数:159

今天项目在 Win10 系统上面启动程序,抛出了如下错误信息:10:34:45,225 |-WARN in ch.qos.logback.core.ConsoleAppender[stdout] - Failed to create WindowsAnsiOutputStream. Falling back on the default stream. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream at  at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:72) at  at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:40) at  at ch.qos.logback.core.ConsoleAppender.getTargetStreamForWindows(ConsoleAppender.java:94) at  at ch.qos.logback.core.ConsoleAppender.start(ConsoleAppender.java:85) at  at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96) at  at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:318) at  at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:197) at  at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:183) at  at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62) at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147) at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133) at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96) at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55) at  at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75) at  at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148) at  at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84) at  at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at  at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128) at  at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107) at  at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295) at  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269) at  at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156) at  at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132) at  at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685) at  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:269) at  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113) at  at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671) at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at  at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at  at java.util.concurrent.FutureTask.run(FutureTask.java) at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at  at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.WindowsAnsiOutputStream at  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at  at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:59) at  ... 39 common frames omitted公共广告位-后端解决办法:(1)什么是 jansi ?Jansi 是一个 Java 类库,它能够让你在控制台输出色彩缤纷的文字。在 Logback 中,使用了 jansi 来实现控制台多颜色输出日志。(2)配置 logback,关闭 jansi<!-- stdout appender定义 --> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">     <withJansi>true</withJansi>     <layout class="ch.qos.logback.classic.PatternLayout">         <pattern>