Olá a todos,
Estou apanhando para conseguir resolver.
Estava tentando enviar um simples email e recebi a seguite exception:
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Provider.java:1245)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:147)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
at javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.mail.util.SocketFetcher.getSocketFactory(SocketFetcher.java:326)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:187)
... 59 more
Caused by: java.security.UnrecoverableKeyException: Password must not be null
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:107)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:38)
at java.security.KeyStore.getKey(KeyStore.java:763)
at com.sun.net.ssl.internal.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:113)
at com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:48)
at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:239)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(DefaultSSLContextImpl.java:170)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.<init>(DefaultSSLContextImpl.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.security.Provider$Service.newInstance(Provider.java:1221)
... 70 more
EmailBean.java:
@ManagedBean
public class EmailBean {
private String mensagem;
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
public String getMensagem() {
return mensagem;
}
public String envia() throws EmailException {
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.mail.yahoo.com.br"); // o servidor SMTP para envio do e-mail
email.addTo("fulano@hotmail.com", "seuNOme"); //destinatário
email.setFrom("meuEmail@yahoo.com.br", "meuNome"); // remetente
email.setSubject("Teste -> Email simples"); // assunto do e-mail
email.setMsg("Teste de Email utilizando commons-email"); //conteudo do e-mail
email.setAuthentication("meuEmail", "minhaSenha");
email.setSmtpPort(465);
email.setSSL(true);
email.setTLS(true);
email.send();
return "/selecoes";
}
}
Alguém já passou por isso, poderia ajudar, por gentileza?
Desde já agradeço!
[]'s