javax.mail.MessagingException:连接失败;

时间:2016-07-21 07:33:59

标签: java email

连接到outlook.office365.com邮件服务时获得以下异常。使用java,同一段代码可以在windows机器上运行。

Cipher: Crypto Permission check failed
Cipher: granted: (CryptoPermission * 128)
Cipher: requesting: (CryptoPermission AES 256)
javax.mail.MessagingException: Connect failed;
    nested exception is:
       java.net.ConnectException: Connection refused
       at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:176)
       at javax.mail.Service.connect(Service.java:291)
       at javax.mail.Service.connect(Service.java:172)
       at org.tester.task.TestMail.main(TestMail.java:25)
     Caused by: java.net.ConnectException: Connection refused
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
       at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
       at java.net.Socket.connect(Socket.java:579)
       at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
       at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
       at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284)
      at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
      at com.sun.mail.pop3.Protocol.<init>(Protocol.java:98)
      at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:227)
      at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:172)
       ... 3 more

0 个答案:

没有答案