gpt4 book ai didi

java - ch.qos.logback.core.util.DynamicClassLoadingException : Failed to instantiate type ch. qos.logback.classic.net.SMTPAppender

转载 作者:行者123 更新时间:2023-12-03 01:28:53 60 4
gpt4 key购买 nike

我的 spring-boot 应用程序中有以下 logback.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
...
</appender>

<timestamp key="datetime" datePattern="yy-MM-dd-HH-mm-ss" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
...
</appender>

<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<smtpHost>smtp.gmail.com</smtpHost>
<smtpPort>587</smtpPort>
<STARTTLS>true</STARTTLS>
<username></username>
<password></password>
<to>admin@gmail.com</to>
<from>dev@gmail.com</from>
<subject>Error</subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout"/>
<asynchronousSending>true</asynchronousSending>
<encoder>
<pattern>
%d{dd.MM.yy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="EMAIL" />
</root>

</configuration>

上下文未出现错误:

java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:73 - ActionException in Action for tag [appender] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [EMAIL]. Did you define it below instead of above in the configuration file?
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.
...

我做错了什么?

最佳答案

compile ('javax.activation:activation:1.1.1')
compile ('javax.mail:mail:1.4.7')

依赖关系帮助了我

关于java - ch.qos.logback.core.util.DynamicClassLoadingException : Failed to instantiate type ch. qos.logback.classic.net.SMTPAppender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46407195/

60 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com