response inline/below.
On Fri, Jan 10, 2014 at 5:40 AM, Radhakrishna Kalyan <[email protected]>wrote: > Hi, > > <snip> > I have a session bean and it is trying to send an email using Java's email > using Transport.send(). > > But I am getting the following exception: > > *javax.mail.MessagingException: java.net.SocketTimeoutException: Read timed > out at > </snip> SocketTimeoutException is 'usually' a valid exception that you 'may' want to handle (or just log to error file) in your app, but keep reading below. <snip> > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.receiveLine(SMTPConnection.java:760) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.receiveLine(SMTPConnection.java:682) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.getReply(SMTPConnection.java:692) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.sendCommand(SMTPConnection.java:655) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.sendQuit(SMTPConnection.java:571) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPConnection.close(SMTPConnection.java:181) > at > > org.apache.geronimo.javamail.transport.smtp.SMTPTransport.close(SMTPTransport.java:503) > </snip> As you can see above, org.apache.geronimo.javamail is a 'wrapper' for (oracle/sun's) javamail (jar). > at javax.mail.Transport.send(Transport.java:144) at > javax.mail.Transport.send(Transport.java:48) at > > com.netgiro.utils.mail.NgMailSenderImpl.sendMessageUsingJavaMail(NgMailSenderImpl.java:228) > at > > com.netgiro.utils.mail.NgMailSenderImpl.sendMessageNow(NgMailSenderImpl.java:196)* > > Any suggestions about how to send email in OpenEJB > When I first started using TomEE (OpenEJB) to send/receive emails, I ran into an unrelated issue/defect, GERONIMO-6421[1]. After reporting that issue to tomee user list, I was advised by David Blevins to do the following: 1. remove geronimo-javamail_1.4_mail-1.8.2.jar from tomee/lib folder 2. drop/replace-that-file-with oracle/sun's javamail JAR file That solved my issue. So, whenever I use new release/snapshot of tomee+, i always repeat the steps above, before I start tomee (and my app). If you continue to experience the SocketTimeoutException, then there is an I.P. connection issue between your app/server and target/email server. Since tomee=tomcat, you can configure your <Connector> in tomee's server.xml to avoid SocketTimeoutException's. While searching my apache/tomee emails, I found the following tomee-user topic, Not loading smtps resource properly[2] you may want to read that topic and search tomee/openejb user list for related topics, if you prefer to use geronimo's wrapper jar. Also, below is my question[3] on tomcat-user list about SocketTimeoutException and someone's response, > From: Howard W. Smith, Jr. [mailto:[email protected]] > Subject: java.net.SocketTimeoutException: Read timed out > The stack trace below is the exception that occurred today. Does this look > like a tomcat or google calendar issue? It has nothing to do with Tomcat; it's your webapp that opened the connection to Google - Tomcat is completely unaware of it. Whether it's a Google limitation or a bug in your webapp can't be determined from just the stack trace. Best if you could get a network traffic capture for the incident and see if the request to Google is malformed, which might well result in the Google server ignoring it. [1] https://issues.apache.org/jira/browse/GERONIMO-6421 [2] http://openejb.979440.n4.nabble.com/Not-loading-smtps-resource-properly-td4664442.html [3] http://tomcat.10.x6.nabble.com/java-net-SocketTimeoutException-Read-timed-out-td4997664.html
