Spring JavaMailSenderImpl javax.mail.NoSuchProviderException: smtp

I have a very large project with tons of dependencies, and when I try to send mail, I get the following exception:

javax.mail.NoSuchProviderException: smtp

I know that the code works because it is part of the library that is used in other projects. Does anyone know what might cause this exception? I looked through the entire jar, and the only one containing "javax.mail" was mail-1.4.4-SNAPSHOT.jar.

Is there a file / class that logs the smtp protocol, and this could happen somewhere else in my classpath?

+3
source share
6 answers

Some time has passed since this question was asked, but it is still worth answering:

, , SMTP ( , ) . , ( , Java EE, Spring - ), javamail API. API, , javax.mail.Session, , .

, , , ClassNotFoundException javax.mail.NoSuchProviderException .

smtp.jar . Maven

    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>smtp</artifactId>
        <version>1.4.5</version>
    </dependency>
+5

. smtp.jar classpath .

+2

, jboss 4.x 6.x.

mail.jar( mail.jar /lib , ). , jar , .

System.out.println(GetClass() getResource ( "/javax//Address.class" ).);

jar, . set classpath , . jar .

+2

, mailapi.jar .

I recently updated the project to use the PayPal soap API, and the PayPal distribution had a mailapi.jar file that was different from the one I had in my project and caused my application to fail when sending mail.

So, for me, I just had to go back to my old mailapi.jar, and I was fine.

+1
source

I had it now. The problem was two javax.mail.jar in the same classpath.

+1
source

Source: https://habr.com/ru/post/1749644/


All Articles