javax.mail.NoSuchProviderException: No provider for smtps

后端 未结 9 1402
离开以前
离开以前 2020-12-11 16:14

I\'m trying to set up my Java project to be able to send e-mail (via g-mail, if it matters) and am getting \"javax.mail.NoSuchProviderException: No provider for smtps\" ever

9条回答
  •  一个人的身影
    2020-12-11 17:00

    JavaMail asks the ClassLoader for the configuration file that configures the protocol providers. If the ClassLoader doesn't work correctly, JavaMail won't be able to find the configuration file. There's an incompatibility between the way the OSGi ClassLoaders work and what JavaMail expects, which can cause this problem. If you're running your application in Eclipse itself, that might explain this problem. Another common cause of this problem is importing the mail.jar file into your project in such a way that the class files are extracted from the jar file and included in your application, but the configuration files are left behind.

    Try running your program from the command line using the "java" command and with the mail.jar file in your CLASSPATH.

提交回复
热议问题