Bug 53471

Summary: mvn fails with s.addTestSuite(org.apache.log4j.net.SMTPAppenderTest.class); in CoreTestSuite
Product: Log4j - Now in Jira Reporter: Josef Stadelmann <josef.stadelmann>
Component: OtherAssignee: log4j-dev <log4j-dev>
Status: NEW ---    
Severity: regression    
Priority: P2    
Version: 1.2.17   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   

Description Josef Stadelmann 2012-06-26 15:28:48 UTC
$ jsvn co http://svn.apache.org/repos/asf/logging/log4j/tags/v1_2_17
on my Vista PC. Then engaged maven 3.0.5 from NetBeans to build log4j-1.2.17
it fails in CoreTestSuite as follow:
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.2:run (runAll) on project log4j: An Ant BuildException has occured: The following error occurred while executing this line:
E:\asf\logging\log4j\tags\v1_2_17\tests\build.xml:187: Test org.apache.log4j.CoreTestSuite failed

    [junit] Testcase: testThrowableRenderer took 0 sec
    [junit] Testcase: testTrigger took 0.031 sec
    [junit] 	Caused an ERROR
    [junit] javax/mail/MessagingException
    [junit] java.lang.NoClassDefFoundError: javax/mail/MessagingException
    [junit] 	at java.lang.Class.getDeclaredConstructors0(Native Method)
    [junit] 	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    [junit] 	at java.lang.Class.getConstructor0(Class.java:2699)
    [junit] 	at java.lang.Class.newInstance0(Class.java:326)
    [junit] 	at java.lang.Class.newInstance(Class.java:308)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:247)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1006)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:896)
    [junit] 	at org.apache.log4j.net.SMTPAppenderTest.testTrigger(SMTPAppenderTest.java:57)
    [junit] Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
    [junit] 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    [junit] 	at java.security.AccessController.doPrivileged(Native Method)
    [junit] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    [junit] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    [junit] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    [junit] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    [junit] 	... 32 more

    [junit] Testcase: testIt took 1.435 sec
    [junit] Testcase: testDefaultRender took 0 sec

I removed the test (shown in subject line) from the test suite and all went OK.
Josef.Stadelmann@axa-winterthur.ch
Comment 1 Josef Stadelmann 2012-06-26 15:29:51 UTC
BTW I can not enter version 1.2.17 as this one is missing, so i used version 1.2 18;
Comment 2 grobmeier 2012-06-28 14:29:21 UTC
Weird, this test runs fine for me. Maybe it is related to the fact the javax.mail.* package is set optional in maven. Could you:

a) look into $user_home/.m2/repos and check if the javax.mail stuff is there?
b) try to change the dependency from "Optional" to "compile" and see if it helps you?

Thanks!
Christian
Comment 3 grobmeier 2012-06-28 14:30:53 UTC
(In reply to comment #1)
> BTW I can not enter version 1.2.17 as this one is missing, so i used version
> 1.2 18;

I create that version and moved the bug to it, thank you!