2017-09-25 81 views
0

我在春天啓動的應用程序如下logback.xmlch.qos.logback.core.util.DynamicClassLoadingException:未能實例類型ch.qos.logback.classic.net.SMTPAppender

<?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>[email protected]</to> 
     <from>[email protected]</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 [email protected]: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. 
... 

什麼我錯了嗎?

回答

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

依賴幫我