Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326030

Summary: Medic diagnostics for unsupported appender types is poor
Product: [RT] Virgo Reporter: Steve Powell <zteve.powell>
Component: unknownAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Steve Powell CLA 2010-09-23 06:35:23 EDT
When using SMTPAppender in serviceability.xml, logback/medic throws an exception during startup which omits mention of the underlying error -- 

--8<-----
org.eclipse.virgo.medic.log.impl.logback.LoggerContextConfigurationFailedException: Configuration failed with the following problems: [Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]., ActionException in Action for tag [appender]]
	at org.eclipse.virgo.medic.log.impl.logback.JoranLoggerContextConfigurer.reportFailureIfNecessary(JoranLoggerContextConfigurer.java:50)
	at org.eclipse.virgo.medic.log.impl.logback.JoranLoggerContextConfigurer.applyConfiguration(JoranLoggerContextConfigurer.java:42)
---------

which is actually a NoClassDefFound error.

The diagnostic code should be improved to put the cause (and the accompanying stacktrace) on the exception that is presently thrown so we can diagnose the problem.
Comment 1 Steve Powell CLA 2010-09-23 09:31:55 EDT
Came from investigation in Bug 322398
Comment 2 Glyn Normington CLA 2010-09-27 11:11:47 EDT
If available, it now also prints the cause. For example:

org.eclipse.virgo.medic.log.impl.logback.LoggerContextConfigurationFailedException: Configuration failed with the following problems: [Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. Caused by java.lang.NoClassDefFoundError: javax/mail/Multipart., ActionException in Action for tag [appender] Caused by ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender.]
	at org.eclipse.virgo.medic.log.impl.logback.JoranLoggerContextConfigurer.reportFailureIfNecessary(JoranLoggerContextConfigurer.java:54)
	at <etc.>

The crucial information buried inside the list of 2 errors is:

java.lang.NoClassDefFoundError: javax/mail/Multipart

which shows that javax.mail is the optional import in medic which needs satisfying.