You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Vamsavardhana Reddy <c1...@gmail.com> on 2006/03/01 17:24:08 UTC

Re: javamail

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

On 1/24/06, Alex Andrushchak <us...@dekasoft.com.ua> wrote:
>
> Hi!
>
> I have only application scope plan, but i think you can use it as start
> point for create your server scope plan:
>
> <application
>        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"<http://geronimo.apache.org/xml/ns/j2ee/application>
>        configId="org/queryphone/Queryphone">
>
>     <dependency>
>         <uri>geronimo/geronimo-mail/1.0</uri>
>     </dependency>
>
>     <dependency>
>         <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>     </dependency>
>
>     <gbean name="mail/MailSession" class="
> org.apache.geronimo.mail.MailGBean">
>         <attribute name="transportProtocol">smtp</attribute>
>         <attribute name="useDefault">false</attribute>
>         <attribute name="host">192.168.1.2</attribute>
>         <attribute name="properties">
>             mail.debug=true
>             mail.smtp.port=25
>             mail.from=queryphone-geronimo@dekasoft.com.ua
>         </attribute>
>     </gbean>
>
> </application>
>
> yskim@symcor.com wrote:
>
> Hello, could I have a good deployment plan XML file so that I can deploy
> mail in the server scope.  I do not want to put the deployment part in
> geronimo-application.xml.  I could find a sample deployment plan for
> javamail.
>
> Thanks,
>
> Young
>
>
>
>
>              "Jakob Færch
>              (Trifork)"
>              <jr...@trifork.com> <jr...@trifork.com>                                          To
>                                        user@geronimo.apache.org
>              20/01/2006 12:55                                           cc
>              PM
>                                                                    Subject
>                                        Re: javamail
>              Please respond to
>              user@geronimo.apa
>                   che.org
>
>
>
>
>
>
>
>
>
> Alex Andrushchak wrote:
>
>  Ok, i've moved from dead point :-)
>
>      Wonderful!
>
>    Now i have another problem:
> Cannot send the message with MailerBean:java.lang.Exception: The message
> can not be send : Unable to locate provider for protocol: smtp
>
>  The transport for smtp is located in the file
> geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>
> By some odd mistake, it is not included in the tomcat distribution.
> If you are using a jetty distribution, the jar file should be there all
> right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
> If you are on a tomcat distribution, I _guess_ you would be fine
> downloading the jetty distribution and manually copying the jar file
> from the above directory in the jetty distribution to the same directory
>   in the tomcat distribution - anyone: feel free to correct me on this!
>
> In order to make the smtp transport available to your application, you
> need to add the following dependency to the application's plan:
> <dependency>
>      <groupId>geronimo</groupId>
>      <artifactId>geronimo-javamail-transport</artifactId>
>      <version>1.0</version>
> </dependency>
>
>
>    My application configuration is:
>    <gbean name="protocol.smtp"
> class="org.apache.geronimo.mail.SMTPTransportGBean">
>        <attribute name="host">192.168.1.2</attribute>
>        <attribute name="port">25</attribute>
>        <attribute
> name="from">queryphone-geronimo@dekasoft.com.ua</attribute>      </gbean>
>
>    <gbean name="mail/MailSession"
> class="org.apache.geronimo.mail.MailGBean">
>        <attribute name="transportProtocol">smtp</attribute>
>        <attribute name="useDefault">true</attribute>
>        <attribute name="properties">mail.debug=true</attribute>
> <reference name="Protocols">
>            <name>protocol.smtp</name>
>        </reference>
>    </gbean>
>
>  It's not (yet) entirely well documented how to set up the necessary
> GBeans - to say the least.
> It seems in the AdventureBuilder (which is able to send mail using the
> smtp transport and javamail), the following GBean is sufficient:
>
> <gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>          <attribute name="host">${smtpHost}</attribute>
>          <attribute name="properties">
>          mail.from=${smtpFrom}
>          mail.smtp.port=${smtpPort}</attribute>
> </gbean>
>
>
> Note that compared to you configuration, the smtp host and port is on
> the MailGBean, not the SMTPTransportGBean. I guess things will work with
> the SMTPTransportGBean configured alongside the MailGBean, but my
> experience was that the SMTPTransportGBean was not necessary - anyone:
> correct me on this!
>
> Alex, I hope this helps you; please keep the list updated on your progress.
>
> Jakob
>
>
>
>
>

Re: javamail

Posted by Alex Andrushchak <us...@dekasoft.com.ua>.
Could you check geronimo log for additional info after debug enabling?

Best regards,
Alex Andrushchak

Vamsavardhana Reddy wrote:

> Hi Alex,
>
> The server is up.  I am able to send mail using this server via 
> standard mail client and I also tried with telnet on port 25.
>
> I also tried addRecipients instead of setRecipients.  I still get the 
> same exception.
>
> Regards,
> Vamsi
>
> On 3/1/06, *Alex Andrushchak* <ustas@dekasoft.com.ua 
> <ma...@dekasoft.com.ua>> wrote:
>
>     Vamsi,
>     Is this server 9.182.150.56 <http://9.182.150.56> up?
>     Is it possible to send mail throught it via standart mail client?
>
>     1. Try to set debug to your session.
>             session.setDebug(true);
>     2. Try to use addRecipients instead of  setRecipients:
>                 ((MimeMessage)
>     message).addRecipients(Message.RecipientType.TO
>     <http://Message.RecipientType.TO>, recipient);
>
>     Best regards,
>     Alex Andrushchak
>
>     Vamsavardhana Reddy wrote:
>
>>     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
>>     <http://9.182.150.56></attribute>
>>             <attribute name="useDefault">false</attribute>
>>             <attribute name="properties">
>>             mail.debug=true
>>             mail.from=c1vamsi1c@gmail.com
>>     <ma...@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
>>     <ma...@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
>>
>>     On 1/24/06, *Alex Andrushchak* < ustas@dekasoft.com.ua
>>     <ma...@dekasoft.com.ua>> wrote:
>>
>>         Hi!
>>
>>         I have only application scope plan, but i think you can use
>>         it as start point for create your server scope plan:
>>
>>         <application
>>               
>>         xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>>         <http://geronimo.apache.org/xml/ns/j2ee/application>
>>                configId="org/queryphone/Queryphone">
>>
>>             <dependency>
>>                 <uri>geronimo/geronimo-mail/1.0</uri>
>>             </dependency>
>>
>>             <dependency>
>>                 <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>>             </dependency>
>>
>>             <gbean name="mail/MailSession"
>>         class="org.apache.geronimo.mail.MailGBean">
>>                 <attribute name="transportProtocol">smtp</attribute>
>>                 <attribute name="useDefault">false</attribute>
>>                 <attribute name="host">192.168.1.2
>>         <http://192.168.1.2></attribute>
>>                 <attribute name="properties">
>>                     mail.debug=true
>>                     mail.smtp.port=25
>>                     mail.from=queryphone-geronimo@dekasoft.com.ua
>>         <ma...@dekasoft.com.ua>
>>                 </attribute>   
>>             </gbean>
>>
>>         </application>
>>
>>
>>         yskim@symcor.com <ma...@symcor.com> wrote:
>>
>>>         Hello, could I have a good deployment plan XML file so that
>>>         I can deploy mail in the server scope. I do not want to put
>>>         the deployment part in geronimo-application.xml
>>>.  I could find a sample deployment plan for
>>>
>>>javamail.
>>>
>>>Thanks,
>>>
>>>Young
>>>
>>>
>>>
>>>                                                                           
>>>             "Jakob Færch                                                  
>>>
>>>             (Trifork)"                                                    
>>>
>>>             
>>>         <jr...@trifork.com> <ma...@trifork.com> To
>>>         user@geronimo.apache.org <ma...@geronimo.apache.org>
>>>         20/01/2006 12:55 cc PM Subject Re: javamail Please respond
>>>         to user@geronimo.apa <ma...@geronimo.apa> che.org
>>>         <http://che.org> Alex Andrushchak wrote:
>>>
>>>>Ok, i've moved from dead point :-)
>>>>
>>>>    
>>>>
>>>Wonderful!
>>>
>>>  
>>>
>>>>Now i have another problem:
>>>>Cannot send the message with MailerBean:java.lang.Exception: The message
>>>>can not be send : Unable to locate provider for protocol: smtp
>>>>    
>>>>
>>>The transport for smtp is located in the file
>>>geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>>>
>>>By some odd mistake, it is not included in the tomcat distribution.
>>>If you are using a jetty distribution, the jar file should be there all
>>>
>>>
>>>right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
>>>If you are on a tomcat distribution, I _guess_ you would be fine
>>>downloading the jetty distribution and manually copying the jar file
>>>from the above directory in the jetty distribution to the same directory
>>>
>>>
>>>  in the tomcat distribution - anyone: feel free to correct me on this!
>>>
>>>In order to make the smtp transport available to your application, you
>>>need to add the following dependency to the application's plan:
>>>
>>>
>>><dependency>
>>>     <groupId>geronimo</groupId>
>>>     <artifactId>geronimo-javamail-transport</artifactId>
>>>     <version>1.0</version>
>>></dependency>
>>>
>>>
>>>
>>>  
>>>
>>>>My application configuration is:
>>>>   <gbean name="protocol.smtp"
>>>>class="org.apache.geronimo.mail.SMTPTransportGBean">
>>>>       <attribute name="host">
>>>>
>>>>192.168.1.2 <http://192.168.1.2></attribute>
>>>>       <attribute name="port">25</attribute>
>>>>       <attribute
>>>>name="from">
>>>>
>>>>queryphone-geronimo@dekasoft.com.ua <ma...@dekasoft.com.ua></attribute>      </gbean>
>>>>
>>>>   <gbean name="mail/MailSession"
>>>>class="org.apache.geronimo.mail.MailGBean">
>>>>       <attribute name="transportProtocol">smtp</attribute>
>>>>
>>>>
>>>>       <attribute name="useDefault">true</attribute>
>>>>       <attribute name="properties">mail.debug=true</attribute>
>>>><reference name="Protocols">
>>>>
>>>>           <name>
>>>>protocol.smtp</name>
>>>>       </reference>
>>>>   </gbean>
>>>>    
>>>>
>>>It's not (yet) entirely well documented how to set up the necessary
>>>GBeans - to say the least.
>>>It seems in the AdventureBuilder (which is able to send mail using the
>>>smtp transport and javamail), the following GBean is sufficient:
>>>
>>>
>>>
>>><gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>>>         <attribute name="host">${smtpHost}</attribute>
>>>         <attribute name="properties">
>>>
>>>
>>>         mail.from=${smtpFrom}
>>>         mail.smtp.port=${smtpPort}</attribute>
>>></gbean>
>>>
>>>
>>>Note that compared to you configuration, the smtp host and port is on
>>>the MailGBean, not the SMTPTransportGBean. I guess things will work with
>>>
>>>
>>>the SMTPTransportGBean configured alongside the MailGBean, but my
>>>experience was that the SMTPTransportGBean was not necessary - anyone:
>>>correct me on this!
>>>
>>>Alex, I hope this helps you; please keep the list updated on your progress.
>>>
>>>
>>>
>>>Jakob
>>>
>>>
>>>
>>>  
>>>
>>
>>
>
>


Re: javamail

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Hi Alex,

The server is up.  I am able to send mail using this server via standard
mail client and I also tried with telnet on port 25.

I also tried addRecipients instead of setRecipients.  I still get the same
exception.

Regards,
Vamsi

On 3/1/06, Alex Andrushchak <us...@dekasoft.com.ua> wrote:
>
> Vamsi,
> Is this server 9.182.150.56 up?
> Is it possible to send mail throught it via standart mail client?
>
> 1. Try to set debug to your session.
>         session.setDebug(true);
> 2. Try to use addRecipients instead of  setRecipients:
>             ((MimeMessage) message).addRecipients(Message.RecipientType.TO,
> recipient);
>
> Best regards,
> Alex Andrushchak
>
> Vamsavardhana Reddy wrote:
>
> 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
>
> On 1/24/06, Alex Andrushchak <us...@dekasoft.com.ua> wrote:
>
> > Hi!
> >
> > I have only application scope plan, but i think you can use it as start
> > point for create your server scope plan:
> >
> > <application
> >        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"<http://geronimo.apache.org/xml/ns/j2ee/application>
> >        configId="org/queryphone/Queryphone">
> >
> >     <dependency>
> >         <uri>geronimo/geronimo-mail/1.0</uri>
> >     </dependency>
> >
> >     <dependency>
> >         <uri>geronimo/geronimo-javamail-transport/1.0</uri>
> >     </dependency>
> >
> >     <gbean name="mail/MailSession" class="
> > org.apache.geronimo.mail.MailGBean">
> >         <attribute name="transportProtocol">smtp</attribute>
> >         <attribute name="useDefault">false</attribute>
> >         <attribute name="host">192.168.1.2</attribute>
> >         <attribute name="properties">
> >             mail.debug=true
> >             mail.smtp.port=25
> >             mail.from=queryphone-geronimo@dekasoft.com.ua
> >         </attribute>
> >     </gbean>
> >
> > </application>
> >
> >
> > yskim@symcor.com wrote:
> >
> > Hello, could I have a good deployment plan XML file so that I can deploy
> > mail in the server scope.  I do not want to put the deployment part in
> > geronimo-application.xml
> > .  I could find a sample deployment plan for
> >
> > javamail.
> >
> > Thanks,
> >
> > Young
> >
> >
> >
> >
> >              "Jakob Færch
> >              (Trifork)"
> >
> >              <jr...@trifork.com> <jr...@trifork.com>                                          To
> >
> > user@geronimo.apache.org
> >              20/01/2006 12:55                                           cc
> >
> >              PM
> >                                                                    Subject
> >                                        Re: javamail
> >
> >              Please respond to
> >              user@geronimo.apa
> >
> >                   che.org
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Alex Andrushchak wrote:
> >
> >  Ok, i've moved from dead point :-)
> >
> >      Wonderful!
> >
> >    Now i have another problem:
> > Cannot send the message with MailerBean:java.lang.Exception: The message
> > can not be send : Unable to locate provider for protocol: smtp
> >
> >  The transport for smtp is located in the file
> > geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
> >
> > By some odd mistake, it is not included in the tomcat distribution.
> > If you are using a jetty distribution, the jar file should be there all
> >
> > right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
> > If you are on a tomcat distribution, I _guess_ you would be fine
> > downloading the jetty distribution and manually copying the jar file
> > from the above directory in the jetty distribution to the same directory
> >
> >   in the tomcat distribution - anyone: feel free to correct me on this!
> >
> > In order to make the smtp transport available to your application, you
> > need to add the following dependency to the application's plan:
> >
> > <dependency>
> >      <groupId>geronimo</groupId>
> >      <artifactId>geronimo-javamail-transport</artifactId>
> >      <version>1.0</version>
> > </dependency>
> >
> >
> >    My application configuration is:
> >    <gbean name="protocol.smtp"
> > class="org.apache.geronimo.mail.SMTPTransportGBean">
> >        <attribute name="host">
> > 192.168.1.2</attribute>
> >        <attribute name="port">25</attribute>
> >        <attribute
> > name="from">
> > queryphone-geronimo@dekasoft.com.ua</attribute>      </gbean>
> >
> >    <gbean name="mail/MailSession"
> > class="org.apache.geronimo.mail.MailGBean">
> >        <attribute name="transportProtocol">smtp</attribute>
> >
> >        <attribute name="useDefault">true</attribute>
> >        <attribute name="properties">mail.debug=true</attribute>
> > <reference name="Protocols">
> >            <name>
> > protocol.smtp</name>
> >        </reference>
> >    </gbean>
> >
> >  It's not (yet) entirely well documented how to set up the necessary
> > GBeans - to say the least.
> > It seems in the AdventureBuilder (which is able to send mail using the
> > smtp transport and javamail), the following GBean is sufficient:
> >
> >
> > <gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
> >          <attribute name="host">${smtpHost}</attribute>
> >          <attribute name="properties">
> >
> >          mail.from=${smtpFrom}
> >          mail.smtp.port=${smtpPort}</attribute>
> > </gbean>
> >
> >
> > Note that compared to you configuration, the smtp host and port is on
> > the MailGBean, not the SMTPTransportGBean. I guess things will work with
> >
> > the SMTPTransportGBean configured alongside the MailGBean, but my
> > experience was that the SMTPTransportGBean was not necessary - anyone:
> > correct me on this!
> >
> > Alex, I hope this helps you; please keep the list updated on your progress.
> >
> >
> > Jakob
> >
> >
> >
> >
> >
>
>

Re: javamail

Posted by Rick McGuire <ri...@gmail.com>.
Vamsavardhana Reddy wrote:
> Alex,
>
> There was a bug in Transport.send().  Transport.send(msg) problem is 
> now fixed.  See related JIRA GERONIMO-1669.
>
> I wonder how it worked for you, pre GERONIMO-1669, without calling 
> transport.connect() explicitly.
The SMTPTransport code in the 1.0 version did not conform with the 
javamail specification with respect to sendMessage() and connect().  The 
1.0 version of sendMessage() was issuing it's own connect() and close(), 
so Transport.send() would have worked on the older version.  JIRA 
GERONIMO-1530 was a major update to the SMTPTransport that cleaned up 
that aspect, and GERONIMO-1593 cleaned up SMTPTransport even more.  
Unfortunately, Transport.send() was also implemented incorrectly, but 
happened to work because of the "equal and opposite bugs".  That one was 
missed when the other updates went in.  I wasn't even aware that 
Transport.send() existed until this morning :-)

Rick

>
> -Vamsi
>
> On 3/1/06, *Alex Andrushchak* <ustas@dekasoft.com.ua 
> <ma...@dekasoft.com.ua>> wrote:
>
>     Vamsi,
>     Is this server 9.182.150.56 <http://9.182.150.56> up?
>     Is it possible to send mail throught it via standart mail client?
>
>     1. Try to set debug to your session.
>             session.setDebug(true);
>     2. Try to use addRecipients instead of  setRecipients:
>                 ((MimeMessage)
>     message).addRecipients(Message.RecipientType.TO
>     <http://Message.RecipientType.TO>, recipient);
>
>     Best regards,
>     Alex Andrushchak
>
>     Vamsavardhana Reddy wrote:
>     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
>     <http://9.182.150.56></attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="properties">
>             mail.debug=true
>             mail.from=c1vamsi1c@gmail.com
>     <ma...@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
>     <ma...@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
>
>     On 1/24/06, *Alex Andrushchak* < ustas@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>> wrote:
>     Hi!
>
>     I have only application scope plan, but i think you can use it as
>     start point for create your server scope plan:
>
>     <application
>            xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>     <http://geronimo.apache.org/xml/ns/j2ee/application>
>            configId="org/queryphone/Queryphone">
>
>         <dependency>
>             <uri>geronimo/geronimo-mail/1.0</uri>
>         </dependency>
>
>         <dependency>
>             <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>         </dependency>
>
>         <gbean name="mail/MailSession"
>     class="org.apache.geronimo.mail.MailGBean">
>             <attribute name="transportProtocol">smtp</attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="host">192.168.1.2
>     <http://192.168.1.2></attribute>
>             <attribute name="properties">
>                 mail.debug=true
>                 mail.smtp.port=25
>                 mail.from=queryphone-geronimo@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>
>             </attribute>   
>         </gbean>
>
>     </application>
>
>
>     yskim@symcor.com <ma...@symcor.com> wrote:
>     Hello, could I have a good deployment plan XML file so that I can
>     deploy mail in the server scope. I do not want to put the
>     deployment part in geronimo-application.xml
>     . I could find a sample deployment plan for javamail. Thanks,
>     Young "Jakob Færch (Trifork)"
>     <jr...@trifork.com> <ma...@trifork.com> To
>     user@geronimo.apache.org <ma...@geronimo.apache.org>
>     20/01/2006 12:55 cc PM Subject Re: javamail Please respond to
>     user@geronimo.apa <ma...@geronimo.apa> che.org
>     <http://che.org> Alex Andrushchak wrote:
>>     Ok, i've moved from dead point :-)
>>
>>         
>     Wonderful!
>
>       
>
>>     Now i have another problem:
>>     Cannot send the message with MailerBean:java.lang.Exception: The message
>>     can not be send : Unable to locate provider for protocol: smtp
>>         
>     The transport for smtp is located in the file
>     geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>
>     By some odd mistake, it is not included in the tomcat distribution.
>     If you are using a jetty distribution, the jar file should be there all
>
>
>     right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
>     If you are on a tomcat distribution, I _guess_ you would be fine
>     downloading the jetty distribution and manually copying the jar file
>     from the above directory in the jetty distribution to the same directory
>
>
>       in the tomcat distribution - anyone: feel free to correct me on this!
>
>     In order to make the smtp transport available to your application, you
>     need to add the following dependency to the application's plan:
>
>
>     <dependency>
>          <groupId>geronimo</groupId>
>          <artifactId>geronimo-javamail-transport</artifactId>
>          <version>1.0</version>
>     </dependency>
>
>
>
>       
>
>>     My application configuration is:
>>        <gbean name="protocol.smtp"
>>     class="org.apache.geronimo.mail.SMTPTransportGBean">
>>            <attribute name="host">
>>
>>     192.168.1.2 <http://192.168.1.2></attribute>
>>            <attribute name="port">25</attribute>
>>            <attribute
>>     name="from">
>>
>>     queryphone-geronimo@dekasoft.com.ua <ma...@dekasoft.com.ua></attribute>      </gbean>
>>
>>        <gbean name="mail/MailSession"
>>     class="org.apache.geronimo.mail.MailGBean">
>>            <attribute name="transportProtocol">smtp</attribute>
>>
>>
>>            <attribute name="useDefault">true</attribute>
>>            <attribute name="properties">mail.debug=true</attribute>
>>     <reference name="Protocols">
>>
>>                <name>
>>     protocol.smtp</name>
>>            </reference>
>>        </gbean>
>>         
>     It's not (yet) entirely well documented how to set up the necessary
>     GBeans - to say the least.
>     It seems in the AdventureBuilder (which is able to send mail using the
>     smtp transport and javamail), the following GBean is sufficient:
>
>
>
>     <gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>              <attribute name="host">${smtpHost}</attribute>
>              <attribute name="properties">
>
>
>              mail.from=${smtpFrom}
>              mail.smtp.port=${smtpPort}</attribute>
>     </gbean>
>
>
>     Note that compared to you configuration, the smtp host and port is on
>     the MailGBean, not the SMTPTransportGBean. I guess things will work with
>
>
>     the SMTPTransportGBean configured alongside the MailGBean, but my
>     experience was that the SMTPTransportGBean was not necessary - anyone:
>     correct me on this!
>
>     Alex, I hope this helps you; please keep the list updated on your progress.
>
>
>
>     Jakob
>
>
>
>       
>
>
>
>
>


Re: javamail

Posted by Alex Andrushchak <us...@dekasoft.com.ua>.
Hi!

I do not know how, but it worked. I've test it in my application.
I runned my sample application with both Geronimo and JoNAS and it worked.

Best regards,
Alex Andrushchak

Vamsavardhana Reddy wrote:

> Alex,
>
> There was a bug in Transport.send().  Transport.send(msg) problem is 
> now fixed.  See related JIRA GERONIMO-1669.
>
> I wonder how it worked for you, pre GERONIMO-1669, without calling 
> transport.connect() explicitly.
>
> -Vamsi
>
> On 3/1/06, *Alex Andrushchak* <ustas@dekasoft.com.ua 
> <ma...@dekasoft.com.ua>> wrote:
>
>     Vamsi,
>     Is this server 9.182.150.56 <http://9.182.150.56> up?
>     Is it possible to send mail throught it via standart mail client?
>
>     1. Try to set debug to your session.
>             session.setDebug(true);
>     2. Try to use addRecipients instead of  setRecipients:
>                 ((MimeMessage)
>     message).addRecipients(Message.RecipientType.TO
>     <http://Message.RecipientType.TO>, recipient);
>
>     Best regards,
>     Alex Andrushchak
>
>     Vamsavardhana Reddy wrote:
>     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
>     <http://9.182.150.56></attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="properties">
>             mail.debug=true
>             mail.from=c1vamsi1c@gmail.com
>     <ma...@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
>     <ma...@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
>
>     On 1/24/06, *Alex Andrushchak* < ustas@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>> wrote:
>     Hi!
>
>     I have only application scope plan, but i think you can use it as
>     start point for create your server scope plan:
>
>     <application
>            xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>     <http://geronimo.apache.org/xml/ns/j2ee/application>
>            configId="org/queryphone/Queryphone">
>
>         <dependency>
>             <uri>geronimo/geronimo-mail/1.0</uri>
>         </dependency>
>
>         <dependency>
>             <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>         </dependency>
>
>         <gbean name="mail/MailSession"
>     class="org.apache.geronimo.mail.MailGBean">
>             <attribute name="transportProtocol">smtp</attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="host">192.168.1.2
>     <http://192.168.1.2></attribute>
>             <attribute name="properties">
>                 mail.debug=true
>                 mail.smtp.port=25
>                 mail.from=queryphone-geronimo@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>
>             </attribute>   
>         </gbean>
>
>     </application>
>
>
>     yskim@symcor.com <ma...@symcor.com> wrote:
>
>     Hello, could I have a good deployment plan XML file so that I can
>     deploy mail in the server scope. I do not want to put the
>     deployment part in geronimo-application.xml
>     . I could find a sample deployment plan for javamail. Thanks,
>     Young "Jakob Færch (Trifork)"
>     <jr...@trifork.com> <ma...@trifork.com> To
>     user@geronimo.apache.org <ma...@geronimo.apache.org>
>     20/01/2006 12:55 cc PM Subject Re: javamail Please respond to
>     user@geronimo.apa <ma...@geronimo.apa> che.org
>     <http://che.org> Alex Andrushchak wrote:
>
>>Ok, i've moved from dead point :-)
>>
>>    
>>
>Wonderful!
>
>  
>
>>Now i have another problem:
>>Cannot send the message with MailerBean:java.lang.Exception: The message
>>can not be send : Unable to locate provider for protocol: smtp
>>    
>>
>The transport for smtp is located in the file
>geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>
>By some odd mistake, it is not included in the tomcat distribution.
>If you are using a jetty distribution, the jar file should be there all
>
>
>right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
>If you are on a tomcat distribution, I _guess_ you would be fine
>downloading the jetty distribution and manually copying the jar file
>from the above directory in the jetty distribution to the same directory
>
>
>  in the tomcat distribution - anyone: feel free to correct me on this!
>
>In order to make the smtp transport available to your application, you
>need to add the following dependency to the application's plan:
>
>
><dependency>
>     <groupId>geronimo</groupId>
>     <artifactId>geronimo-javamail-transport</artifactId>
>     <version>1.0</version>
></dependency>
>
>
>
>  
>
>>My application configuration is:
>>   <gbean name="protocol.smtp"
>>class="org.apache.geronimo.mail.SMTPTransportGBean">
>>       <attribute name="host">
>>
>>192.168.1.2 <http://192.168.1.2></attribute>
>>       <attribute name="port">25</attribute>
>>       <attribute
>>name="from">
>>
>>queryphone-geronimo@dekasoft.com.ua <ma...@dekasoft.com.ua></attribute>      </gbean>
>>
>>   <gbean name="mail/MailSession"
>>class="org.apache.geronimo.mail.MailGBean">
>>       <attribute name="transportProtocol">smtp</attribute>
>>
>>
>>       <attribute name="useDefault">true</attribute>
>>       <attribute name="properties">mail.debug=true</attribute>
>><reference name="Protocols">
>>
>>           <name>
>>protocol.smtp</name>
>>       </reference>
>>   </gbean>
>>    
>>
>It's not (yet) entirely well documented how to set up the necessary
>GBeans - to say the least.
>It seems in the AdventureBuilder (which is able to send mail using the
>smtp transport and javamail), the following GBean is sufficient:
>
>
>
><gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>         <attribute name="host">${smtpHost}</attribute>
>         <attribute name="properties">
>
>
>         mail.from=${smtpFrom}
>         mail.smtp.port=${smtpPort}</attribute>
></gbean>
>
>
>Note that compared to you configuration, the smtp host and port is on
>the MailGBean, not the SMTPTransportGBean. I guess things will work with
>
>
>the SMTPTransportGBean configured alongside the MailGBean, but my
>experience was that the SMTPTransportGBean was not necessary - anyone:
>correct me on this!
>
>Alex, I hope this helps you; please keep the list updated on your progress.
>
>
>
>Jakob
>
>
>
>  
>
>
>
>
>


Re: javamail

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Alex,

There was a bug in Transport.send().  Transport.send(msg) problem is now
fixed.  See related JIRA GERONIMO-1669.

I wonder how it worked for you, pre GERONIMO-1669, without calling
transport.connect() explicitly.

-Vamsi

On 3/1/06, Alex Andrushchak <us...@dekasoft.com.ua> wrote:
>
> Vamsi,
> Is this server 9.182.150.56 up?
> Is it possible to send mail throught it via standart mail client?
>
> 1. Try to set debug to your session.
>         session.setDebug(true);
> 2. Try to use addRecipients instead of  setRecipients:
>             ((MimeMessage) message).addRecipients(Message.RecipientType.TO,
> recipient);
>
> Best regards,
> Alex Andrushchak
>
> Vamsavardhana Reddy wrote:
>
> 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
>
> On 1/24/06, Alex Andrushchak <us...@dekasoft.com.ua> wrote:
>
> > Hi!
>
> I have only application scope plan, but i think you can use it as start
> point for create your server scope plan:
>
> <application
>        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"<http://geronimo.apache.org/xml/ns/j2ee/application>
>        configId="org/queryphone/Queryphone">
>
>     <dependency>
>         <uri>geronimo/geronimo-mail/1.0</uri>
>     </dependency>
>
>     <dependency>
>         <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>     </dependency>
>
>     <gbean name="mail/MailSession" class="
> org.apache.geronimo.mail.MailGBean">
>         <attribute name="transportProtocol">smtp</attribute>
>         <attribute name="useDefault">false</attribute>
>         <attribute name="host">192.168.1.2</attribute>
>         <attribute name="properties">
>             mail.debug=true
>             mail.smtp.port=25
>             mail.from=queryphone-geronimo@dekasoft.com.ua
>         </attribute>
>     </gbean>
>
> </application>
>
>
> yskim@symcor.com wrote:
>
> Hello, could I have a good deployment plan XML file so that I can deploy
> mail in the server scope. I do not want to put the deployment part in
> geronimo-application.xml
> . I could find a sample deployment plan for javamail. Thanks, Young "Jakob
> Færch (Trifork)"
> <jr...@trifork.com> <jr...@trifork.com> To user@geronimo.apache.org 20/01/2006
> 12:55 cc PM Subject Re: javamail Please respond to user@geronimo.apa
> che.org Alex Andrushchak wrote:
>
> Ok, i've moved from dead point :-)
>
>      Wonderful!
>
>    Now i have another problem:
> Cannot send the message with MailerBean:java.lang.Exception: The message
> can not be send : Unable to locate provider for protocol: smtp
>
>  The transport for smtp is located in the file
> geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>
> By some odd mistake, it is not included in the tomcat distribution.
> If you are using a jetty distribution, the jar file should be there all
>
> right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
> If you are on a tomcat distribution, I _guess_ you would be fine
> downloading the jetty distribution and manually copying the jar file
> from the above directory in the jetty distribution to the same directory
>
>   in the tomcat distribution - anyone: feel free to correct me on this!
>
> In order to make the smtp transport available to your application, you
> need to add the following dependency to the application's plan:
>
> <dependency>
>      <groupId>geronimo</groupId>
>      <artifactId>geronimo-javamail-transport</artifactId>
>      <version>1.0</version>
> </dependency>
>
>
>    My application configuration is:
>    <gbean name="protocol.smtp"
> class="org.apache.geronimo.mail.SMTPTransportGBean">
>        <attribute name="host">
> 192.168.1.2</attribute>
>        <attribute name="port">25</attribute>
>        <attribute
> name="from">
> queryphone-geronimo@dekasoft.com.ua</attribute>      </gbean>
>
>    <gbean name="mail/MailSession"
> class="org.apache.geronimo.mail.MailGBean">
>        <attribute name="transportProtocol">smtp</attribute>
>
>        <attribute name="useDefault">true</attribute>
>        <attribute name="properties">mail.debug=true</attribute>
> <reference name="Protocols">
>            <name>
> protocol.smtp</name>
>        </reference>
>    </gbean>
>
>  It's not (yet) entirely well documented how to set up the necessary
> GBeans - to say the least.
> It seems in the AdventureBuilder (which is able to send mail using the
> smtp transport and javamail), the following GBean is sufficient:
>
>
> <gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>          <attribute name="host">${smtpHost}</attribute>
>          <attribute name="properties">
>
>          mail.from=${smtpFrom}
>          mail.smtp.port=${smtpPort}</attribute>
> </gbean>
>
>
> Note that compared to you configuration, the smtp host and port is on
> the MailGBean, not the SMTPTransportGBean. I guess things will work with
>
> the SMTPTransportGBean configured alongside the MailGBean, but my
> experience was that the SMTPTransportGBean was not necessary - anyone:
> correct me on this!
>
> Alex, I hope this helps you; please keep the list updated on your progress.
>
>
> Jakob
>
>
>
>
>
>
>

Re: javamail

Posted by Alex Andrushchak <us...@dekasoft.com.ua>.
Vamsi,
Is this server 9.182.150.56 <http://9.182.150.56> up?
Is it possible to send mail throught it via standart mail client?

1. Try to set debug to your session.
        session.setDebug(true);
2. Try to use addRecipients instead of  setRecipients:
            ((MimeMessage) 
message).addRecipients(Message.RecipientType.TO, recipient);

Best regards,
Alex Andrushchak

Vamsavardhana Reddy wrote:

> 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 
> <http://9.182.150.56></attribute>
>         <attribute name="useDefault">false</attribute>
>         <attribute name="properties">
>         mail.debug=true
>         mail.from=c1vamsi1c@gmail.com 
> <ma...@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 
> <ma...@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
>
> On 1/24/06, *Alex Andrushchak* <ustas@dekasoft.com.ua 
> <ma...@dekasoft.com.ua>> wrote:
>
>     Hi!
>
>     I have only application scope plan, but i think you can use it as
>     start point for create your server scope plan:
>
>     <application
>            xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>     <http://geronimo.apache.org/xml/ns/j2ee/application>
>            configId="org/queryphone/Queryphone">
>
>         <dependency>
>             <uri>geronimo/geronimo-mail/1.0</uri>
>         </dependency>
>
>         <dependency>
>             <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>         </dependency>
>
>         <gbean name="mail/MailSession"
>     class="org.apache.geronimo.mail.MailGBean">
>             <attribute name="transportProtocol">smtp</attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="host">192.168.1.2
>     <http://192.168.1.2></attribute>
>             <attribute name="properties">
>                 mail.debug=true
>                 mail.smtp.port=25
>                 mail.from=queryphone-geronimo@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>
>             </attribute>   
>         </gbean>
>
>     </application>
>
>
>     yskim@symcor.com <ma...@symcor.com> wrote:
>
>>Hello, could I have a good deployment plan XML file so that I can deploy
>>mail in the server scope.  I do not want to put the deployment part in
>>geronimo-application.xml.  I could find a sample deployment plan for
>>
>>javamail.
>>
>>Thanks,
>>
>>Young
>>
>>
>>
>>                                                                           
>>             "Jakob Færch                                                  
>>             (Trifork)"                                                    
>>
>>             <jr...@trifork.com> <ma...@trifork.com>                                          To 
>>                                       
>>user@geronimo.apache.org <ma...@geronimo.apache.org>            
>>             20/01/2006 12:55                                           cc 
>>
>>             PM                                                            
>>                                                                   Subject 
>>                                       Re: javamail                        
>>
>>             Please respond to                                             
>>             user@geronimo.apa <ma...@geronimo.apa>
>>                                             
>>                  che.org <http://che.org>                                                  
>>
>>                                                                           
>>                                                                           
>>                                                                           
>>
>>
>>
>>
>>
>>
>>
>>Alex Andrushchak wrote:
>>  
>>
>>>Ok, i've moved from dead point :-)
>>>
>>>    
>>>
>>Wonderful!
>>
>>  
>>
>>>Now i have another problem:
>>>Cannot send the message with MailerBean:java.lang.Exception: The message
>>>can not be send : Unable to locate provider for protocol: smtp
>>>    
>>>
>>The transport for smtp is located in the file
>>geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>>
>>By some odd mistake, it is not included in the tomcat distribution.
>>If you are using a jetty distribution, the jar file should be there all
>>
>>right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
>>If you are on a tomcat distribution, I _guess_ you would be fine
>>downloading the jetty distribution and manually copying the jar file
>>from the above directory in the jetty distribution to the same directory
>>
>>  in the tomcat distribution - anyone: feel free to correct me on this!
>>
>>In order to make the smtp transport available to your application, you
>>need to add the following dependency to the application's plan:
>>
>><dependency>
>>     <groupId>geronimo</groupId>
>>     <artifactId>geronimo-javamail-transport</artifactId>
>>     <version>1.0</version>
>></dependency>
>>
>>
>>  
>>
>>>My application configuration is:
>>>   <gbean name="protocol.smtp"
>>>class="org.apache.geronimo.mail.SMTPTransportGBean">
>>>       <attribute name="host">
>>>192.168.1.2 <http://192.168.1.2></attribute>
>>>       <attribute name="port">25</attribute>
>>>       <attribute
>>>name="from">
>>>queryphone-geronimo@dekasoft.com.ua <ma...@dekasoft.com.ua></attribute>      </gbean>
>>>
>>>   <gbean name="mail/MailSession"
>>>class="org.apache.geronimo.mail.MailGBean">
>>>       <attribute name="transportProtocol">smtp</attribute>
>>>
>>>       <attribute name="useDefault">true</attribute>
>>>       <attribute name="properties">mail.debug=true</attribute>
>>><reference name="Protocols">
>>>           <name>
>>>protocol.smtp</name>
>>>       </reference>
>>>   </gbean>
>>>    
>>>
>>It's not (yet) entirely well documented how to set up the necessary
>>GBeans - to say the least.
>>It seems in the AdventureBuilder (which is able to send mail using the
>>smtp transport and javamail), the following GBean is sufficient:
>>
>>
>><gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>>         <attribute name="host">${smtpHost}</attribute>
>>         <attribute name="properties">
>>
>>         mail.from=${smtpFrom}
>>         mail.smtp.port=${smtpPort}</attribute>
>></gbean>
>>
>>
>>Note that compared to you configuration, the smtp host and port is on
>>the MailGBean, not the SMTPTransportGBean. I guess things will work with
>>
>>the SMTPTransportGBean configured alongside the MailGBean, but my
>>experience was that the SMTPTransportGBean was not necessary - anyone:
>>correct me on this!
>>
>>Alex, I hope this helps you; please keep the list updated on your progress.
>>
>>
>>Jakob
>>
>>
>>
>>  
>>
>
>


Re: javamail

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Rick,

Replacing Transport.send(msg) with

       Transport tr = mailSession.getTransport("smtp");
       tr.connect(smtphost, username, password);
       msg.saveChanges(); // don't forget this
       tr.sendMessage(msg, msg.getAllRecipients());
       tr.close();

has solved the problem.

Thanks,
Vamsi

On 3/2/06, Rick McGuire <ri...@gmail.com> wrote:
>
> Vamsavardhana Reddy wrote:
>
> This looks like a bug in Geronimo's implementation of Transport.send().
> It's not connecting to the transport before sending the message.  I'll
> take care of fixing this, since I'm poking around in the javamail code
> these days.
>
> As a work around, don't use Transport.send() to send the message.
> Instead, request a transport object from the session and send the
> message that way.  Here's a snippet I know works:
>
>        Transport tr = mailSession.getTransport("smtp");
>        tr.connect(smtphost, username, password);
>        msg.saveChanges(); // don't forget this
>        tr.sendMessage(msg, msg.getAllRecipients());
>        tr.close();
>
> Rick
>
> > 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
> > <http://9.182.150.56></attribute>
> >         <attribute name="useDefault">false</attribute>
> >         <attribute name="properties">
> >         mail.debug=true
> >         mail.from=c1vamsi1c@gmail.com
> > <ma...@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
> > <ma...@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
> >
> > On 1/24/06, *Alex Andrushchak* <ustas@dekasoft.com.ua
> > <ma...@dekasoft.com.ua>> wrote:
> >
> >     Hi!
> >
> >     I have only application scope plan, but i think you can use it as
> >     start point for create your server scope plan:
> >
> >     <application
> >            xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
> >     <http://geronimo.apache.org/xml/ns/j2ee/application>
> >            configId="org/queryphone/Queryphone">
> >
> >         <dependency>
> >             <uri>geronimo/geronimo-mail/1.0</uri>
> >         </dependency>
> >
> >         <dependency>
> >             <uri>geronimo/geronimo-javamail-transport/1.0</uri>
> >         </dependency>
> >
> >         <gbean name="mail/MailSession"
> >     class="org.apache.geronimo.mail.MailGBean">
> >             <attribute name="transportProtocol">smtp</attribute>
> >             <attribute name="useDefault">false</attribute>
> >             <attribute name="host">192.168.1.2
> >     <http://192.168.1.2></attribute>
> >             <attribute name="properties">
> >                 mail.debug=true
> >                 mail.smtp.port=25
> >                 mail.from=queryphone-geronimo@dekasoft.com.ua
> >     <ma...@dekasoft.com.ua>
> >             </attribute>
> >         </gbean>
> >
> >     </application>
> >
> >
> >     yskim@symcor.com <ma...@symcor.com> wrote:
> >>     Hello, could I have a good deployment plan XML file so that I can
> deploy
> >>     mail in the server scope.  I do not want to put the deployment part
> in
> >>     geronimo-application.xml.  I could find a sample deployment plan
> for
> >>
> >>     javamail.
> >>
> >>     Thanks,
> >>
> >>     Young
> >>
> >>
> >>
> >>
> >>                  "Jakob Færch
> >>                  (Trifork)"
> >>
> >>                  <jr...@trifork.com> <mailto:jrf@trifork.com
> >                                          To
> >>
> >>     user@geronimo.apache.org <ma...@geronimo.apache.org>
> >>                  20/01/2006
> 12:55                                           cc
> >>
> >>                  PM
>
> >>                                                                        Subject
> >>                                            Re: javamail
> >>
> >>                  Please respond to
> >>                  user@geronimo.apa <ma...@geronimo.apa>
> >>
> >>                       che.org <http://che.org>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>     Alex Andrushchak wrote:
> >>
> >>>     Ok, i've moved from dead point :-)
> >>>
> >>>
> >>     Wonderful!
> >>
> >>
> >>>     Now i have another problem:
> >>>     Cannot send the message with MailerBean:java.lang.Exception: The
> message
> >>>     can not be send : Unable to locate provider for protocol: smtp
> >>>
> >>     The transport for smtp is located in the file
> >>
> geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
> >>
> >>     By some odd mistake, it is not included in the tomcat distribution.
> >>     If you are using a jetty distribution, the jar file should be there
> all
> >>
> >>     right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
> >>     If you are on a tomcat distribution, I _guess_ you would be fine
> >>     downloading the jetty distribution and manually copying the jar
> file
> >>     from the above directory in the jetty distribution to the same
> directory
> >>
> >>       in the tomcat distribution - anyone: feel free to correct me on
> this!
> >>
> >>     In order to make the smtp transport available to your application,
> you
> >>     need to add the following dependency to the application's plan:
> >>
> >>     <dependency>
> >>          <groupId>geronimo</groupId>
> >>          <artifactId>geronimo-javamail-transport</artifactId>
> >>          <version>1.0</version>
> >>     </dependency>
> >>
> >>
> >>
> >>>     My application configuration is:
> >>>        <gbean name="protocol.smtp"
> >>>     class="org.apache.geronimo.mail.SMTPTransportGBean">
> >>>            <attribute name="host">
> >>>     192.168.1.2 <http://192.168.1.2></attribute>
> >>>            <attribute name="port">25</attribute>
> >>>            <attribute
> >>>     name="from">
> >>>     queryphone-geronimo@dekasoft.com.ua <mailto:
> queryphone-geronimo@dekasoft.com.ua></attribute>      </gbean>
> >>>
> >>>        <gbean name="mail/MailSession"
> >>>     class="org.apache.geronimo.mail.MailGBean">
> >>>            <attribute name="transportProtocol">smtp</attribute>
> >>>
> >>>            <attribute name="useDefault">true</attribute>
> >>>            <attribute name="properties">mail.debug=true</attribute>
> >>>     <reference name="Protocols">
> >>>                <name>
> >>>     protocol.smtp</name>
> >>>            </reference>
> >>>        </gbean>
> >>>
> >>     It's not (yet) entirely well documented how to set up the necessary
> >>     GBeans - to say the least.
> >>     It seems in the AdventureBuilder (which is able to send mail using
> the
> >>     smtp transport and javamail), the following GBean is sufficient:
> >>
> >>
> >>     <gbean name="mail/MailSession" class="
> org.apache.geronimo.mail.MailGBean">
> >>              <attribute name="host">${smtpHost}</attribute>
> >>              <attribute name="properties">
> >>
> >>              mail.from=${smtpFrom}
> >>              mail.smtp.port=${smtpPort}</attribute>
> >>     </gbean>
> >>
> >>
> >>     Note that compared to you configuration, the smtp host and port is
> on
> >>     the MailGBean, not the SMTPTransportGBean. I guess things will work
> with
> >>
> >>     the SMTPTransportGBean configured alongside the MailGBean, but my
> >>     experience was that the SMTPTransportGBean was not necessary -
> anyone:
> >>     correct me on this!
> >>
> >>     Alex, I hope this helps you; please keep the list updated on your
> progress.
> >>
> >>
> >>     Jakob
> >>
> >>
> >>
> >>
> >
> >
>
>

Re: javamail

Posted by Rick McGuire <ri...@gmail.com>.
Vamsavardhana Reddy wrote:

This looks like a bug in Geronimo's implementation of Transport.send().  
It's not connecting to the transport before sending the message.  I'll 
take care of fixing this, since I'm poking around in the javamail code 
these days. 

As a work around, don't use Transport.send() to send the message.  
Instead, request a transport object from the session and send the 
message that way.  Here's a snippet I know works:

       Transport tr = mailSession.getTransport("smtp");
       tr.connect(smtphost, username, password);
       msg.saveChanges(); // don't forget this
       tr.sendMessage(msg, msg.getAllRecipients());
       tr.close();

Rick

> 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 
> <http://9.182.150.56></attribute>
>         <attribute name="useDefault">false</attribute>
>         <attribute name="properties">
>         mail.debug=true
>         mail.from=c1vamsi1c@gmail.com 
> <ma...@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 
> <ma...@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
>
> On 1/24/06, *Alex Andrushchak* <ustas@dekasoft.com.ua 
> <ma...@dekasoft.com.ua>> wrote:
>
>     Hi!
>
>     I have only application scope plan, but i think you can use it as
>     start point for create your server scope plan:
>
>     <application
>            xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>     <http://geronimo.apache.org/xml/ns/j2ee/application>
>            configId="org/queryphone/Queryphone">
>
>         <dependency>
>             <uri>geronimo/geronimo-mail/1.0</uri>
>         </dependency>
>
>         <dependency>
>             <uri>geronimo/geronimo-javamail-transport/1.0</uri>
>         </dependency>
>
>         <gbean name="mail/MailSession"
>     class="org.apache.geronimo.mail.MailGBean">
>             <attribute name="transportProtocol">smtp</attribute>
>             <attribute name="useDefault">false</attribute>
>             <attribute name="host">192.168.1.2
>     <http://192.168.1.2></attribute>
>             <attribute name="properties">
>                 mail.debug=true
>                 mail.smtp.port=25
>                 mail.from=queryphone-geronimo@dekasoft.com.ua
>     <ma...@dekasoft.com.ua>
>             </attribute>   
>         </gbean>
>
>     </application>
>
>
>     yskim@symcor.com <ma...@symcor.com> wrote:
>>     Hello, could I have a good deployment plan XML file so that I can deploy
>>     mail in the server scope.  I do not want to put the deployment part in
>>     geronimo-application.xml.  I could find a sample deployment plan for
>>
>>     javamail.
>>
>>     Thanks,
>>
>>     Young
>>
>>
>>
>>                                                                                
>>                  "Jakob Færch                                                  
>>                  (Trifork)"                                                    
>>
>>                  <jr...@trifork.com> <ma...@trifork.com>                                          To 
>>                                            
>>     user@geronimo.apache.org <ma...@geronimo.apache.org>            
>>                  20/01/2006 12:55                                           cc 
>>
>>                  PM                                                            
>>                                                                        Subject 
>>                                            Re: javamail                        
>>
>>                  Please respond to                                             
>>                  user@geronimo.apa <ma...@geronimo.apa>
>>                                                  
>>                       che.org <http://che.org>                                                  
>>
>>                                                                                
>>                                                                                
>>                                                                                
>>
>>
>>
>>
>>
>>
>>
>>     Alex Andrushchak wrote:
>>       
>>>     Ok, i've moved from dead point :-)
>>>
>>>         
>>     Wonderful!
>>
>>       
>>>     Now i have another problem:
>>>     Cannot send the message with MailerBean:java.lang.Exception: The message
>>>     can not be send : Unable to locate provider for protocol: smtp
>>>         
>>     The transport for smtp is located in the file
>>     geronimo-1.0\repository\geronimo\jars\geronimo-javamail-transport-1.0.jar.
>>
>>     By some odd mistake, it is not included in the tomcat distribution.
>>     If you are using a jetty distribution, the jar file should be there all
>>
>>     right in GERONIMO_INSTALL_DIR/repository/geronimo/jars.
>>     If you are on a tomcat distribution, I _guess_ you would be fine
>>     downloading the jetty distribution and manually copying the jar file
>>     from the above directory in the jetty distribution to the same directory
>>
>>       in the tomcat distribution - anyone: feel free to correct me on this!
>>
>>     In order to make the smtp transport available to your application, you
>>     need to add the following dependency to the application's plan:
>>
>>     <dependency>
>>          <groupId>geronimo</groupId>
>>          <artifactId>geronimo-javamail-transport</artifactId>
>>          <version>1.0</version>
>>     </dependency>
>>
>>
>>       
>>>     My application configuration is:
>>>        <gbean name="protocol.smtp"
>>>     class="org.apache.geronimo.mail.SMTPTransportGBean">
>>>            <attribute name="host">
>>>     192.168.1.2 <http://192.168.1.2></attribute>
>>>            <attribute name="port">25</attribute>
>>>            <attribute
>>>     name="from">
>>>     queryphone-geronimo@dekasoft.com.ua <ma...@dekasoft.com.ua></attribute>      </gbean>
>>>
>>>        <gbean name="mail/MailSession"
>>>     class="org.apache.geronimo.mail.MailGBean">
>>>            <attribute name="transportProtocol">smtp</attribute>
>>>
>>>            <attribute name="useDefault">true</attribute>
>>>            <attribute name="properties">mail.debug=true</attribute>
>>>     <reference name="Protocols">
>>>                <name>
>>>     protocol.smtp</name>
>>>            </reference>
>>>        </gbean>
>>>         
>>     It's not (yet) entirely well documented how to set up the necessary
>>     GBeans - to say the least.
>>     It seems in the AdventureBuilder (which is able to send mail using the
>>     smtp transport and javamail), the following GBean is sufficient:
>>
>>
>>     <gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
>>              <attribute name="host">${smtpHost}</attribute>
>>              <attribute name="properties">
>>
>>              mail.from=${smtpFrom}
>>              mail.smtp.port=${smtpPort}</attribute>
>>     </gbean>
>>
>>
>>     Note that compared to you configuration, the smtp host and port is on
>>     the MailGBean, not the SMTPTransportGBean. I guess things will work with
>>
>>     the SMTPTransportGBean configured alongside the MailGBean, but my
>>     experience was that the SMTPTransportGBean was not necessary - anyone:
>>     correct me on this!
>>
>>     Alex, I hope this helps you; please keep the list updated on your progress.
>>
>>
>>     Jakob
>>
>>
>>
>>       
>
>