tutorial jax java server jboss7.x javamail wildfly

jax - java client soap



Wildfly-9 javax.mail no funciona (2)

Está intentando conectarse a smtp.gmail.com en el puerto 465, que es un puerto SSL, pero JavaMail no cree que quiera usar SSL. Probablemente estés fallando en la negociación del protocolo SSL. Algo está mal con la forma en que está configurando la sesión de JavaMail que está utilizando.

Estoy haciendo uso de Wildfly 9.0.0 Final y javax.mail api en mi aplicación.

Estoy obteniendo el siguiente registro:

2015-07-27 15:08:16,318 CONFIG [javax.mail] (default task-17) Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} 2015-07-27 15:08:16,318 CONFIG [javax.mail] (default task-17) Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} 2015-07-27 15:08:16,319 CONFIG [javax.mail] (default task-17) successfully loaded resource: /META-INF/javamail.default.address.map 2015-07-27 15:08:16,340 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) TO : [email protected] 2015-07-27 15:08:16,341 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) ccAddresses : 2015-07-27 15:08:16,341 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) bccAddresses : 2015-07-27 15:08:16,341 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) messagesender : [email protected] 2015-07-27 15:08:16,341 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) I subjectFriend recommends "Admin" opening at "ALECTO HEALTHCARE" 2015-07-27 15:08:16,346 DEBUG [class com.bodhtree.nexus.util.mail.Mail] (default task-17) Message: javax.mail.internet.MimeMessage@6be2cbe7 2015-07-27 15:08:16,357 FINE [javax.activation] (default task-17) MailcapCommandMap: load HOME 2015-07-27 15:08:16,359 FINE [javax.activation] (default task-17) new MailcapFile: file C:/Users/kiran.MAHATHI/.mailcap 2015-07-27 15:08:16,360 FINE [javax.activation] (default task-17) MailcapCommandMap: load SYS 2015-07-27 15:08:16,360 FINE [javax.activation] (default task-17) new MailcapFile: file C:/Program Files/Java/jdk1.8.0_45/jre/lib/mailcap 2015-07-27 15:08:16,360 FINE [javax.activation] (default task-17) MailcapCommandMap: load JAR 2015-07-27 15:08:16,362 FINE [javax.activation] (default task-17) MailcapCommandMap: getResources 2015-07-27 15:08:16,362 FINE [javax.activation] (default task-17) MailcapCommandMap: URL vfs:/C:/Work/wildfly-9.0.0.Final/bin/content/SmarthiresMaven.war/WEB-INF/lib/mail-1.4.jar/META-INF/mailcap 2015-07-27 15:08:16,363 FINE [javax.activation] (default task-17) new MailcapFile: InputStream 2015-07-27 15:08:16,364 FINE [javax.activation] (default task-17) parse: text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain 2015-07-27 15:08:16,364 FINE [javax.activation] (default task-17) Type: text/plain 2015-07-27 15:08:16,364 FINE [javax.activation] (default task-17) Command: content-handler, Class: com.sun.mail.handlers.text_plain 2015-07-27 15:08:16,364 FINE [javax.activation] (default task-17) parse: text/html;; x-java-content-handler=com.sun.mail.handlers.text_html 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) Type: text/html 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) Command: content-handler, Class: com.sun.mail.handlers.text_html 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) parse: text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) Type: text/xml 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) Command: content-handler, Class: com.sun.mail.handlers.text_xml 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) parse: multipart;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed; x-java-fallback-entry=true 2015-07-27 15:08:16,365 FINE [javax.activation] (default task-17) Type: multipart 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) Command: content-handler, Class: com.sun.mail.handlers.multipart_mixed 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) parse: message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) Type: message/rfc822 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) Command: content-handler, Class: com.sun.mail.handlers.message_rfc822 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) MailcapCommandMap: successfully loaded mailcap file from URL: vfs:/C:/Work/wildfly-9.0.0.Final/bin/content/SmarthiresMaven.war/WEB-INF/lib/mail-1.4.jar/META-INF/mailcap 2015-07-27 15:08:16,366 FINE [javax.activation] (default task-17) MailcapCommandMap: load DEF 2015-07-27 15:08:16,367 FINE [javax.activation] (default task-17) new MailcapFile: InputStream 2015-07-27 15:08:16,367 FINE [javax.activation] (default task-17) parse: image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer 2015-07-27 15:08:16,367 FINE [javax.activation] (default task-17) Type: image/gif 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) Command: view, Class: com.sun.activation.viewers.ImageViewer 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) parse: image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) Type: image/jpeg 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) Command: view, Class: com.sun.activation.viewers.ImageViewer 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) parse: text x-java-view=com.sun.activation.viewers.TextViewer 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) Type: text 2015-07-27 15:08:16,368 FINE [javax.activation] (default task-17) Command: view, Class: com.sun.activation.viewers.TextViewer 2015-07-27 15:08:16,370 FINE [javax.activation] (default task-17) parse: text x-java-edit=com.sun.activation.viewers.TextEditor 2015-07-27 15:08:16,371 FINE [javax.activation] (default task-17) Type: text 2015-07-27 15:08:16,371 FINE [javax.activation] (default task-17) Command: edit, Class: com.sun.activation.viewers.TextEditor 2015-07-27 15:08:16,371 FINE [javax.activation] (default task-17) Merging commands for type text 2015-07-27 15:08:16,372 FINE [javax.activation] (default task-17) MailcapCommandMap: successfully loaded mailcap file: /META-INF/mailcap.default 2015-07-27 15:08:16,372 FINE [javax.activation] (default task-17) MailcapCommandMap: createDataContentHandler for text/html 2015-07-27 15:08:16,372 FINE [javax.activation] (default task-17) search DB #1 2015-07-27 15:08:16,373 FINE [javax.activation] (default task-17) got content-handler 2015-07-27 15:08:16,373 FINE [javax.activation] (default task-17) class com.sun.mail.handlers.text_html 2015-07-27 15:08:16,385 FINE [javax.mail] (default task-17) getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] 2015-07-27 15:08:16,448 FINE [com.sun.mail.smtp] (default task-17) need username and password for authentication 2015-07-27 15:08:16,449 FINE [com.sun.mail.smtp] (default task-17) useEhlo true, useAuth true 2015-07-27 15:08:16,450 FINE [com.sun.mail.smtp] (default task-17) trying to connect to host "smtp.gmail.com", port 465, isSSL false 2015-07-27 15:09:24,610 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name kirankumar 2015-07-27 15:09:34,613 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name kirankumar 2015-07-27 15:11:34,620 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name kirankumar 2015-07-27 15:11:44,621 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name kirankumar

Y no estoy usando ningún tipo de EJB en mi aplicación. Y lo intenté con Wildfly 8.2.0 y funciona para mí. pero mi aplicación requiere Wildfly 9. No pude encontrar lo que estaba causando el problema.


Finalmente encontré que se debe al módulo de correo en Wildfly9.0.0.Final. Podemos hacer esto como una solución temporal. Y funciona para mí.

Abra standalone-ha.xml desde <wildfly-9.0.0.Final-Home>/standalone/configuration

Releace lo siguiente

<subsystem xmlns="urn:jboss:domain:mail:2.0"> <mail-session name="default" jndi-name="java:jboss/mail/Default"> <smtp-server outbound-socket-binding-ref="mail-smtp"/> </mail-session> </subsystem>

Con

<subsystem xmlns="urn:jboss:domain:mail:2.0"> <mail-session name="default" jndi-name="java:jboss/mail/Default"> </mail-session> </subsystem>

Ahora abra "module.xml" desde <wildfly-9.0.0.Final-Home>/modules/system/layers/base/javax/mail/api/main

Reemplace la siguiente línea

<resource-root path="javax.mail-1.5.3.jar"/>

Con

<resource-root path="javax.mail-1.5.1.jar"/>

Y copie el formulario "javax.mail-1.5.1.jar"

<wildfly-8.2.0.Final -Home>/modules/system/layers/base/javax/mail/api/main

A

<wildfly-9.0.0.Final-Home>/modules/system/layers/base/javax/mail/api/main

Y elimine "javax.mail-1.5.3.jar"

desde el

<wildfly-9.0.0.Final-Home>/modules/system/layers/base/javax/mail/api/main

Y reinicia el servidor. Esto funciona para mi.