Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3265

Java Mail: NoSuchProviderException for any default provider with a Seam 2 application

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.1.0.Final
    • 7.1.0.Final
    • EE
    • Workaround Exists
    • Hide

      In the module org.jboss.as.mail, replace
      <module name="javax.mail.api"/>
      by
      <module name="javax.mail.api"><imports><include path="META-INF"/></imports></module>

      Show
      In the module org.jboss.as.mail, replace <module name="javax.mail.api"/> by <module name="javax.mail.api"><imports><include path="META-INF"/></imports></module>

      My web application contains Seam 2.2.2, which has a META-INF/javamail.providers.

      In javax.mail.Session.loadProviders(Class cl):

      loadAllResources("META-INF/javamail.providers", cl, loader);

      => load Seam 2.2.2's mock provider.

      loadResource("/META-INF/javamail.default.providers", cl, loader);

      => should load Java Mail's default providers, but given class is org.jboss.as.mail.extension.MailSessionService$PasswordAuthentication, which has no access to java mail's META-INF

      if (providers.size() == 0)
         pr("DEBUG: failed to load any providers, using defaults");

      => unfortunately, Seam's mock loader has been loaded, and no default will be loaded.

      Then, using Java Mail I get:

      javax.mail.NoSuchProviderException: No provider for smtp
              at javax.mail.Session.getProvider(Session.java:464) [mail-1.4.4.jar:1.4.4]
              at javax.mail.Session.getTransport(Session.java:659) [mail-1.4.4.jar:1.4.4]
              at javax.mail.Session.getTransport(Session.java:640) [mail-1.4.4.jar:1.4.4]
              at javax.mail.Session.getTransport(Session.java:626) [mail-1.4.4.jar:1.4.4]
      

              tomazcerar Tomaž Cerar (Inactive)
              guinotphil Philippe Guinot (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: