You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Rick McGuire (JIRA)" <de...@geronimo.apache.org> on 2006/03/02 12:42:32 UTC
[jira] Created: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
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
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:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
<dependency>
<uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
</dependency>
<dependency>
<uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
</dependency>
<context-root>/MailWebApp</context-root>
<context-priority-classloader>false</context-priority-classloader>
<resource-ref>
<ref-name>mail/MailSession</ref-name>
<target-name>
geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
</target-name>
</resource-ref>
<gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
<attribute name="transportProtocol">smtp</attribute>
<attribute name="host">9.182.150.56</attribute>
<attribute name="useDefault">false</attribute>
<attribute name="properties">
mail.debug=true
mail.from=c1vamsi1c@gmail.com
mail.smtp.port=25</attribute>
</gbean>
</web-app>
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
[jira] Closed: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Jacek Laskowski (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=all ]
Jacek Laskowski closed GERONIMO-1669:
-------------------------------------
Verified by Vamsavardhana Reddy. Thanks!
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Commented: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Jacek Laskowski (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=comments#action_12368486 ]
Jacek Laskowski commented on GERONIMO-1669:
-------------------------------------------
You're right, but how can I apply the patch if the module tests fail? I had a glimpse of what's going on in the code *before* I commented the issue and couldn't find out how it had worked before. So, I was wondering how you tested your change? I think it's important to fix the code (which I'm not very familiar with) *before* applying any patches if they're irrelevant or don't bring us closer to fix it.
> 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
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Commented: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Vamsavardhana Reddy (JIRA)" <de...@geronimo.apache.org>.
[ 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Commented: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Rick McGuire (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=comments#action_12368485 ]
Rick McGuire commented on GERONIMO-1669:
----------------------------------------
That's a different issue unrelated to the thing the Jira fixes. The use of InternetAddress.getLocalAddress() checks a number of different system and session properties to see if there is a local address defined, and returns null if it is not. setFrom(), if it receiveds null, calls InternetAddress.getLocalAddress() itself to resolve this (and it's gonna return null again). To fix this, change the setFrom() line to use any dummy address (setFrom(new InternetAddress("me@somewhere.org")).
On checking this out, I discovered the G version doesn't do all the same checks that the Sun impl documents, but that's another Jira issue to take care of.
> 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
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Updated: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Rick McGuire (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=all ]
Rick McGuire updated GERONIMO-1669:
-----------------------------------
Attachment: GERONIMO-1669.patch
Applied to geronimo-spec-javamail module of the specs tree.
> 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
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Commented: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Jacek Laskowski (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=comments#action_12368479 ]
Jacek Laskowski commented on GERONIMO-1669:
-------------------------------------------
I was about to commit the patch, but was unable to pass the tests successfully (mvn test). The exception was:
javax.mail.MessagingException: No local address defined
at javax.mail.internet.MimeMessage.setFrom(MimeMessage.java:298)
at javax.mail.internet.MimeMessageTest.testFrom(MimeMessageTest.java:102)
Does the tests pass for you?
> 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
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Resolved: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Jacek Laskowski (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=all ]
Jacek Laskowski resolved GERONIMO-1669:
---------------------------------------
Fix Version: 1.1
Resolution: Fixed
Assign To: Jacek Laskowski
$ svn ci -m 'GERONIMO-1669: javamail Transport.send() is not issuing connect() on the transport before sending the message' .
Sending geronimo-spec-javamail/src/main/java/javax/mail/Transport.java
Transmitting file data .
Committed revision 382388.
Thanks Rick!
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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
[jira] Commented: (GERONIMO-1669) javamail Transport.send() is not
issuing connect() on the transport before sending the message.
Posted by "Rick McGuire (JIRA)" <de...@geronimo.apache.org>.
[ http://issues.apache.org/jira/browse/GERONIMO-1669?page=comments#action_12368489 ]
Rick McGuire commented on GERONIMO-1669:
----------------------------------------
Ah, sorry, I didn't read your earlier comment closely enough. Yes, all of the module tests pass for me, but I'm not sure I can explain why it is working for me and not for you. InternetAddress().getLocalAddress() depends on a number of session/system properties being set to resolve the address. For some reason, these are getting set properly for me automatically, but not for you. Bruce Snyder also has not had a problem with this. Here is a short patch to the MimeMessageTest module to explicitly configure some of the properties to remove the system setup dependencies to the test.
Index: src/test/java/javax/mail/internet/MimeMessageTest.java
===================================================================
--- src/test/java/javax/mail/internet/MimeMessageTest.java (revision 381685)
+++ src/test/java/javax/mail/internet/MimeMessageTest.java (working copy)
@@ -377,7 +377,9 @@
myMap.addMailcap("text/plain;; x-java-content-handler=" + MimeMultipartTest.DummyTextHandler.class.getName());
myMap.addMailcap("multipart/*;; x-java-content-handler=" + MimeMultipartTest.DummyMultipartHandler.class.getName());
CommandMap.setDefaultCommandMap(myMap);
- session = Session.getDefaultInstance(new Properties());
+ Properties props = new Properties();
+ props.put("mail.from", "tester@apache.org");
+ session = Session.getDefaultInstance(props);
}
protected void tearDown() throws Exception {
> 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
> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" configId="MailWebApp/MailWebApp">
> <dependency>
> <uri>geronimo/geronimo-mail/1.2-SNAPSHOT</uri>
> </dependency>
> <dependency>
> <uri>geronimo/geronimo-javamail-transport/1.2-SNAPSHOT</uri>
> </dependency>
> <context-root>/MailWebApp</context-root>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>mail/MailSession</ref-name>
> <target-name>
> geronimo.server:J2EEApplication=null,J2EEModule=MailWebApp/MailWebApp,J2EEServer=geronimo,j2eeType=JavaMailResource,name=MailSession
> </target-name>
> </resource-ref>
>
> <gbean name="MailSession" class="org.apache.geronimo.mail.MailGBean">
> <attribute name="transportProtocol">smtp</attribute>
> <attribute name="host">9.182.150.56</attribute>
> <attribute name="useDefault">false</attribute>
> <attribute name="properties">
> mail.debug=true
> mail.from=c1vamsi1c@gmail.com
> mail.smtp.port=25</attribute>
> </gbean>
> </web-app>
> 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