Announcement Announcement Module
Collapse
No announcement yet.
JavaMailSenderImpl - NoSuchProviderException: smtp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JavaMailSenderImpl - NoSuchProviderException: smtp

    I have a very large project with a ton of dependancies, and am getting the following exception when trying to send mail via JavaMailSenderImpl:

    javax.mail.NoSuchProviderException: smtp

    I know the code works because it is part of a library that is used in other projects. Does anyone know what would cause this exception to happen? I have looked through all of the jar's and the only one containing 'javax.mail' is 'mail-1.4.4-SNAPSHOT.jar'.

    Is there some file/class that registeres the 'smtp' protocol, and it could be happening somewhere else in my classpath?

  • #2
    Ensure you have both mail.jar and smtp.jar in your classpath...
    (see JavaMail NOTES.txt file)

    Comment


    • #3
      Do you know what classes are included in smtp.jar, or a maven artifact that I can included - currently I only have 'javax.mail': http://mvnrepository.com/artifact/javax.mail/mail/1.4

      Actually - nm - it seems that the mail.jar I have in the classpath does have all of the smtp.jar classes:

      com/sun/mail/smtp/SMTPSaslAuthenticator.class
      com/sun/mail/smtp/SMTPTransport$DigestMD5Authenticator.class
      com/sun/mail/smtp/SMTPSaslAuthenticator$1.class
      com/sun/mail/smtp/SMTPTransport.class
      com/sun/mail/smtp/SMTPTransport$LoginAuthenticator.class
      com/sun/mail/smtp/SMTPTransport$Authenticator.class
      com/sun/mail/smtp/SaslAuthenticator.class
      com/sun/mail/smtp/SMTPTransport$NtlmAuthenticator.class
      com/sun/mail/smtp/SMTPSSLTransport.class
      com/sun/mail/smtp/SMTPAddressFailedException.class
      com/sun/mail/smtp/DigestMD5.class
      com/sun/mail/smtp/SMTPSenderFailedException.class
      com/sun/mail/smtp/SMTPTransport$PlainAuthenticator.class
      com/sun/mail/smtp/SMTPSendFailedException.class
      com/sun/mail/smtp/SMTPAddressSucceededException.class
      com/sun/mail/smtp/SMTPMessage.class
      com/sun/mail/smtp/SMTPOutputStream.class
      In the NOTES.txt it does say, however:

      - You can't mix and match the Sun protocol providers between different
      releases of the JavaMail API. The Sun protocol providers depend on
      implementation-specific utility APIs within the mailapi.jar file.
      (Third party protocol providers that don't depend on these APIs
      should work fine.)
      Some of the dependency jars are a compilation of a bunch of jars - what do I need to look for in regards to the above quote? I am thinking there may be 2 versions of the same library in there somewhere.
      Last edited by wuntee; Jun 15th, 2010, 04:03 PM.

      Comment


      • #4
        so, here is something weird - when i remove the mail-4.1.jar from the classpath, it works fine...

        Comment

        Working...
        X