Version 5

    Why do I get exceptions in the mail services unit tests when running against JBoss prior to 3.2.4RC1

     

    Mail services will work in JBoss 3.2.1-3.2.3 but the unit tests will not work.  The reason is that we use the ServerImpl and JBoss JMX microkernel to run the required mail service MBeans outside of the regular appserver. 

     

    However, the microkernel was depending on a particular classloader order which cannot be/is not true when running in Ant's classloader.  Therefore patches where made to not require the package name and so forth to be set.

     

    The microkernel also made some assumptions with regards to setting the root classloader that are not true when running inside of a junit test (you can only set it once inside of a runnning VM).  Patches were made to not do this on subsequent attemps.

     

    Therefore, for the unit tests to work you will need 3.2.4RC1 even though Mail Services itself does not require it.  These patches were probably as a side effect useful to anyone else unit testing JMX components outside of JBoss using the microkernel and microkernel embedders.

     

    example output from 3.2.3:

     

        [junit] TEST org.jboss.mail.log.TestMailLog FAILED
    Fails with:
        [junit] EXCEPTION: java.lang.NullPointerException:null
        [junit] at org.jboss.system.server.ServerImpl.doInit(ServerImpl.java:161)
        [junit] at org.jboss.system.server.ServerImpl.init(ServerImpl.java:126)
        [junit] at org.jboss.mail.MBeanServerUtil.configureMBeanServerFactory(MBeanServerUtil.java:59)
    
        [junit] TEST org.jboss.mail.smtp.handlers.TestCmdSTARTTLS FAILED
        [junit] TEST org.jboss.mail.smtp.TestSMTPProtocol FAILED
        [junit] TEST org.jboss.mail.TestServer FAILED
    These fail with:
        [junit] ERROR: java.lang.Error:factory already defined
        [junit] at java.net.URL.setURLStreamHandlerFactory(URL.java:980)
        [junit] at org.jboss.system.server.ServerImpl.internalInitURLHandlers(ServerImpl.java:222)
        [junit] at org.jboss.system.server.ServerImpl.initURLHandlers(ServerImpl.java:195)
        [junit] at org.jboss.system.server.ServerImpl.doInit(ServerImpl.java:155)
        [junit] at org.jboss.system.server.ServerImpl.init(ServerImpl.java:126)
        [junit] at org.jboss.mail.MBeanServerUtil.configureMBeanServerFactory(MBeanServerUtil.java:59)