From dev-return-26125-apmail-geronimo-dev-archive=geronimo.apache.org@geronimo.apache.org Thu Mar 02 17:24:45 2006 Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 15364 invoked from network); 2 Mar 2006 17:24:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Mar 2006 17:24:43 -0000 Received: (qmail 53935 invoked by uid 500); 2 Mar 2006 17:25:11 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 53850 invoked by uid 500); 2 Mar 2006 17:25:11 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 53809 invoked by uid 99); 2 Mar 2006 17:25:11 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2006 09:25:10 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 3297E183 for ; Thu, 2 Mar 2006 18:24:49 +0100 (CET) Message-ID: <1826873702.1141320289205.JavaMail.jira@ajax.apache.org> Date: Thu, 2 Mar 2006 18:24:49 +0100 (CET) From: "Vamsavardhana Reddy (JIRA)" To: dev@geronimo.apache.org Subject: [jira] Commented: (GERONIMO-1669) javamail Transport.send() is not issuing connect() on the transport before sending the message. In-Reply-To: <319956596.1141299752575.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/GERONIMO-1669?page=comments#action_12368548 ] Vamsavardhana Reddy commented on GERONIMO-1669: ----------------------------------------------- Transport.send(msg) works properly now. Server built from revision 382452. > javamail Transport.send() is not issuing connect() on the transport before sending the message. > ----------------------------------------------------------------------------------------------- > > Key: GERONIMO-1669 > URL: http://issues.apache.org/jira/browse/GERONIMO-1669 > Project: Geronimo > Type: Bug > Components: mail > Versions: 1.x > Reporter: Rick McGuire > Assignee: Jacek Laskowski > Fix For: 1.1 > Attachments: GERONIMO-1669.patch > > This was reported on the geronimo user list (problem report attached below). The error is occuring because the Transport.send() code is failing to surround the sendMessage() call with connect() and close() calls on the transport, resulting in the connection failure. Additionally, this code is not properly merging send failures for multiple transports into a single SendFailedException with proper reporting of which addresses the message was not sent to. > Hi Alex, > I am trying to send mail from a servlet. Here is my geronimo-web.xml: > > > > geronimo/geronimo-mail/1.2-SNAPSHOT > > > geronimo/geronimo-javamail-transport/1.2-SNAPSHOT > > /MailWebApp > false > > mail/MailSession > > geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession > > > > > smtp > 9.182.150.56 > false > > mail.debug=true > mail.from=c1vamsi1c@gmail.com > mail.smtp.port=25 > > > Here are the imports and the doGet() method in my servlet. > import javax.mail.Session; > import javax.mail.Transport; > import javax.mail.Message.RecipientType; > import javax.mail.internet.InternetAddress; > import javax.mail.internet.MimeMessage; > protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { > > response.setContentType("text/plain"); > > PrintWriter out = response.getWriter(); > > try { > InitialContext ic = new InitialContext(); > > Session mailSession = (Session) ic.lookup("java:comp/env/mail/MailSession"); > mailSession.setDebug(true); > mailSession.setDebugOut(System.err); > out.println("session = "+mailSession); > > MimeMessage msg = new MimeMessage(mailSession); > > msg.setRecipients(RecipientType.TO, new InternetAddress[] {new InternetAddress("c1vamsi1c@gmail.com")}); > > msg.setSubject("Mail sent by MailerServlet"); > > msg.setText("Hello"); > > msg.setFrom(InternetAddress.getLocalAddress(mailSession)); > > Transport.send(msg); > } catch (Exception e) { > e.printStackTrace(out); > } > } > When I access the servlet, I am getting the following Exception. > java.lang.IllegalStateException: Not connected > at org.apache.geronimo.javamail.transport.smtp.SMTPTransport.sendMessage(SMTPTransport.java:356) > at javax.mail.Transport.send(Transport.java:80) > at javax.mail.Transport.send > (Transport.java:46) > at mailwebapp.MailerServlet.doGet(MailerServlet.java:64) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > at org.apache.catalina.core.StandardWrapperValve.invoke > (StandardWrapperValve.java:213) > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) > at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:46) > at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:273) > at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31) > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) > at org.apache.catalina.core.StandardEngineValve.invoke > (StandardEngineValve.java:107) > at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541) > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > at org.apache.coyote.http11.Http11Processor.process > (Http11Processor.java:869) > at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667) > at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java > :527) > at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > at java.lang.Thread.run > (Unknown Source) > Any guesses on what I am doing differently? > Thanks, > Vamsi -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira