9 Replies Latest reply on Aug 28, 2008 2:26 AM by Jiri Pechanec

    Problem in Notify Email

    neha2911 Newbie

      I want to send an email to the user after the successful action pipeline is completed. I have used NotifyEmail for this but this is not working. The SMTP host is not picked up from the jboss-properties.xml .

      The error is

      2008-08-27 16:18:42,546 INFO [STDOUT] ConsoleNotifier 2008/08/27 04:18:42.546<<CountryDetais><Country Code="us"><Name>United States of America</Name><Rate>8.33</Rate><ISD>71</ISD>
      </Country><Country Code="in"><Name>India</Name><Rate>0</Rate>
      <ISD>91</ISD></Country><Country Code="au"><Name>Australia</Name><Rate>7.69</Rate><ISD>21</ISD></Country></CountryDetais>>
      2008-08-27 16:18:42,562 WARN [org.jboss.soa.esb.helpers.Email] 'org.jboss.soa.esb.mail.smtp.auth' set to an empty value.
       2008-08-27 16:18:42,562 INFO [org.jboss.soa.esb.helpers.Email] Initialising mail server sesson. Properties: {mail.smtp.port=25, mail.smtp.auth=true, mail.smtp.host=localhost}
      2008-08-27 16:18:43,671 ERROR [org.jboss.soa.esb.notification.NotificationList] Can't instantiate target <target class="NotifyEmail" from="Neha.Pandey@lntinfotech.com" sendTo="Neha.Pandey@lntinfotech.com" subject="Hello">
       </target>
      org.jboss.soa.esb.notification.NotificationException: javax.mail.MessagingException: Exception reading response;
       nested exception is:
       java.net.SocketException: Connection reset
       at org.jboss.soa.esb.notification.NotifyEmail.sendNotification(NotifyEmail.java:127)
       at org.jboss.soa.esb.notification.NotificationList.notifyAll(NotificationList.java:164)
       at org.jboss.soa.esb.actions.Notifier.notifyOK(Notifier.java:93)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processSuccess(ActionProcessorMethodInfo.java:165)
       at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.processSuccess(OverriddenActionLifecycleProcessor.java:108)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.notifySuccess(ActionProcessingPipeline.java:610)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:384)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:530)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.mail.MessagingException: Exception reading response;
       nested exception is:
       java.net.SocketException: Connection reset
       at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
       at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
       at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
       at javax.mail.Service.connect(Service.java:310)
       at javax.mail.Service.connect(Service.java:169)
       at javax.mail.Service.connect(Service.java:118)
       at javax.mail.Transport.send0(Transport.java:188)
       at javax.mail.Transport.send(Transport.java:118)
       at org.jboss.soa.esb.helpers.Email.sendMessage(Email.java:181)
       at org.jboss.soa.esb.notification.NotifyEmail.sendEmailNotification(NotifyEmail.java:151)
       at org.jboss.soa.esb.notification.NotifyEmail.sendNotification(NotifyEmail.java:115)
       ... 14 more
      Caused by: java.net.SocketException: Connection reset
       at java.net.SocketInputStream.read(SocketInputStream.java:168)
       at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
       at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
       at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)
       ... 24 more


      I have set the properties in Jboss-properties.xml file
      <properties name="transports" depends="core">
       <property name="org.jboss.soa.esb.mail.smtp.host" value="172.25.8.13"/>
       <property name="org.jboss.soa.esb.mail.smtp.user" value=""/>
       <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
       <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
       </properties>


      My Jbossesb.xml is

      <service category="QuickstartTransformCSV" name="SimpleListener"
       description="Hello World">
       <listeners>
       <jms-listener name="CSVJMS-Gateway" busidref="quickstartCSVGwChannel" maxThreads="1" is-gateway="true"/>
       <jms-listener name="CSVquickstart" busidref="quickstartCSVEsbChannel" maxThreads="1" />
       </listeners>
      
       <actions mep="OneWay">
      
       <action class="org.jboss.soa.esb.actions.Notifier" name="notificationAction">
       <property name="notification-details">
       <NotificationList type="OK">
       <target class="NotifyConsole"/>
       <target class="NotifyQueues">
       <messageProp name="quickstart" value="Calculator_Response"/>
       <queue jndiName="queue/quickstart_log_Queue"/>
       </target>
       <target class="NotifyEmail" from="Neha.Pandey@lntinfotech.com" sendTo="Neha.Pandey@lntinfotech.com"
       subject="Hello">
       </target>
       </NotificationList>
      
       </property>
       <property name="okMethod" value="notifyOK"/>
       <!--property name="exceptionMethod" value="notifyError"/-->
       </action>
       <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="message" value="[transform_CSV2Smooks_Intermediate_format] Message before CVS to XML transformation" />
       </action>
      
       <!--
       Transform 1: CSV to XML...
       -->
       <action name="transform-from-csv" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
       <property name="resource-config" value="/smooks-res.xml" />
       <property name="from-type" value="text/csv:country-list" />
       <property name="to-type" value="text/xml:smooks-country-xml" />
       </action>
      
       <action name="print-after-csv-tranform" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="message" value="[transform_CSV2Smooks_Intermediate_format] Message after CVS to XML transformation" />
       </action>
      
       <!--
       Transform 2: XML to XML...
       -->
       <action name="transform-smooksXml-to-canonicalXml" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
       <property name="resource-config" value="/smooks-res.xml" />
       <property name="from-type" value="text/xml:smooks-country-xml" />
       <property name="to-type" value="text/xml:canonical-country-xml" />
       </action>
      
       <action name="print-after-xml-transform" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="message" value=">>>> Message after Smooks intermediate xml -> target xml : " />
       </action>
      
       <!-- The next action is for Continuous Integration testing -->
       <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
       </actions>
      
       </service>



      How should i go about this?Whta is the problem?

        • 1. Re: Problem in Notify Email
          Daniel Bevenius Master

          Can you double check you jbossesb.sar/jbossesb-properties.xml. It should have a section that looks like this:

          <properties name="transports" depends="core">
           <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
           <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
           <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
           <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
           <property name="org.jboss.soa.esb.mail.smtp.auth" value="true"/>
           ....
          

          The 'org.jboss.soa.esb.mail.smtp.auth' seems to be missing from yours. You might need to configure this property to suite you mail servers setup.

          Regards,

          /Daniel


          • 2. Re: Problem in Notify Email
            neha2911 Newbie

             

            Can you double check you jbossesb.sar/jbossesb-properties.xml. It should have a section that looks like this:


            I have edited jbossesb.sar/jbossesb-properties.xml also. The file looks like.

            properties name="transports" depends="core">
             <property name="org.jboss.soa.esb.mail.smtp.host" value="172.25.8.13" />
             <property name="org.jboss.soa.esb.mail.smtp.user" value="" />
             <property name="org.jboss.soa.esb.mail.smtp.password" value="" />
             <property name="org.jboss.soa.esb.mail.smtp.port" value="25" />
             <property name="org.jboss.soa.esb.mail.smtp.auth" value="true" />
             <property name="org.jboss.soa.esb.ftp.localdir" value="/tmp" />
             <property name="org.jboss.soa.esb.ftp.remotedir" value="/tmp" />
             <property name="org.jboss.soa.esb.jms.connectionPool" value="20" />
             <property name="org.jboss.soa.esb.jms.sessionSleep" value="30" />
             </properties>


            The error persists. What should be done?

            • 3. Re: Problem in Notify Email
              Daniel Bevenius Master

              Does you email server accept an empty username and password?

              • 4. Re: Problem in Notify Email
                neha2911 Newbie

                yes my server can accept empty username and password.But the problem is that in server log it is giving

                2008-08-27 16:18:42,562 INFO [org.jboss.soa.esb.helpers.Email] Initialising mail server sesson. Pro
                perties: {mail.smtp.port=25, mail.smtp.auth=true, mail.smtp.host=localhost}


                So what should i do?

                • 5. Re: Problem in Notify Email
                  Daniel Bevenius Master

                   

                  2008-08-27 16:18:42,562 INFO [org.jboss.soa.esb.helpers.Email] Initialising mail server sesson. Pro
                  perties: {mail.smtp.port=25, mail.smtp.auth=true, mail.smtp.host=localhost}

                  This is only showing the properties used to intialize the session. The authentication information is passed to the Session.getInstance method like this:
                  javax.mail.Session oMailSess = javax.mail.Session.getInstance(oMailP, oAuth);

                  oAuth being an instance of Authenticator.

                  So what should i do?

                  Please make sure that you can connect to your mail server running on localhost, port 25 and using an empty username and password. Does this work?

                  Regards,

                  /Daniel

                  • 6. Re: Problem in Notify Email
                    neha2911 Newbie

                    My mail server is running on 172.25.8.13 and i have configured it using

                    <property name="org.jboss.soa.esb.mail.smtp.host"value="172.25.8.13 />
                    in jbossesb.sar/jbossesb-properties and jbossesb-properties in my src folder.

                    Is there any other configuration to be done to set SMTP host?

                    • 7. Re: Problem in Notify Email
                      Daniel Bevenius Master

                      The only one that needs to be configued in jbossesb.sar/jbossesb-properties.xml like this:

                      ...
                      <property name="org.jboss.soa.esb.mail.smtp.host" value="85.224.158.27"/>
                      ...
                      

                      I've tried this and this is what my server logs:
                      07:21:57,215 INFO [Email] Initialising mail server sesson. Properties: {mail.smtp.port=25, mail.smtp.auth=false, mail.smtp.host=85.224.158.27}


                      If you send me your jbossesb.sar/jbossesb-properties.xml and I can try using it to see if it works for me.
                      What version are you using?

                      Regards,

                      /Daniel



                      • 8. Re: Problem in Notify Email
                        neha2911 Newbie

                        Iam using jboss-soa-p.4.2.0 which has JBoss ESB 4.2.1 GA.

                        My jbossesb.sar/jbossesb-properties.xml is

                        <?xml version="1.0" encoding="ISO-8859-1" ?>
                        - <!-- JBoss, Home of Professional Open Source
                         Copyright 2006, JBoss Inc., and others contributors as indicated
                         by the @authors tag. All rights reserved.
                         See the copyright.txt in the distribution for a
                         full listing of individual contributors.
                         This copyrighted material is made available to anyone wishing to use,
                         modify, copy, or redistribute it subject to the terms and conditions
                         of the GNU Lesser General Public License, v. 2.1.
                         This program is distributed in the hope that it will be useful, but WITHOUT A
                         WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
                         PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
                         You should have received a copy of the GNU Lesser General Public License,
                         v.2.1 along with this distribution; if not, write to the Free Software
                         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
                         MA 02110-1301, USA.
                        
                         (C) 2005-2006,
                         @author JBoss Inc.
                        
                         -->
                        - <!-- $Id: jbossesb-unittest-properties.xml $
                         -->
                        - <!-- These options are described in the JBossESB manual.
                         Defaults are provided here for convenience only.
                        
                         Please read through this file prior to using the system, and consider
                         updating the specified entries.
                        
                         -->
                        - <esb xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
                        - <properties name="core">
                         <property name="org.jboss.soa.esb.jndi.server.context.factory" value="org.jnp.interfaces.NamingContextFactory" />
                         <property name="org.jboss.soa.esb.jndi.server.url" value="${jboss.bind.address}:1099" />
                         <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl" />
                         <property name="org.jboss.soa.esb.loadbalancer.policy" value="org.jboss.soa.esb.listeners.ha.RoundRobin" />
                         </properties>
                        - <properties name="registry">
                         <property name="org.jboss.soa.esb.registry.queryManagerURI" value="org.apache.juddi.registry.local.InquiryService#inquire" />
                         <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#publish" />
                         <property name="org.jboss.soa.esb.registry.implementationClass" value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl" />
                         <property name="org.jboss.soa.esb.registry.factoryClass" value="org.apache.ws.scout.registry.ConnectionFactoryImpl" />
                         <property name="org.jboss.soa.esb.registry.user" value="jbossesb" />
                         <property name="org.jboss.soa.esb.registry.password" value="password" />
                        - <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap)
                         -->
                         <property name="org.jboss.soa.esb.scout.proxy.transportClass" value="org.apache.ws.scout.transport.LocalTransport" />
                         </properties>
                        - <properties name="transports" depends="core">
                         <property name="org.jboss.soa.esb.mail.smtp.host" value="172.25.10.11" />
                         <property name="org.jboss.soa.esb.mail.smtp.user" value="" />
                         <property name="org.jboss.soa.esb.mail.smtp.password" value="" />
                         <property name="org.jboss.soa.esb.mail.smtp.port" value="25" />
                         <property name="org.jboss.soa.esb.mail.smtp.auth" value="true" />
                         <property name="org.jboss.soa.esb.ftp.localdir" value="/tmp" />
                         <property name="org.jboss.soa.esb.ftp.remotedir" value="/tmp" />
                         <property name="org.jboss.soa.esb.jms.connectionPool" value="20" />
                         <property name="org.jboss.soa.esb.jms.sessionSleep" value="30" />
                         </properties>
                        - <properties name="connection">
                         <property name="min-pool-size" value="5" />
                         <property name="max-pool=size" value="10" />
                         <property name="blocking-timeout-millis" value="5000" />
                         <property name="abandoned-connection-timeout" value="10000" />
                         <property name="abandoned-connection-time-interval" value="30000" />
                         </properties>
                        - <properties name="dbstore">
                        - <!-- connection manager type
                         -->
                        - <!-- <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
                         -->
                         <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.J2eeConnectionManager" />
                        - <!-- this property is only used if using the j2ee connection manager
                         -->
                         <property name="org.jboss.soa.esb.persistence.db.datasource.name" value="java:/JBossESBDS" />
                        - <!-- standalone connection pooling settings
                         -->
                         <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/" />
                         <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver" />
                         <property name="org.jboss.soa.esb.persistence.db.user" value="sa" />
                         <property name="org.jboss.soa.esb.persistence.db.pwd" value="" />
                         <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2" />
                         <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2" />
                         <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5" />
                        - <!-- table managed by pool to test for valid connections - created by pool automatically
                         -->
                         <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest" />
                         <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000" />
                         </properties>
                        - <properties name="filters">
                         <property name="org.jboss.soa.esb.filter.1" value="org.jboss.internal.soa.esb.message.filter.MetaDataFilter" />
                         <property name="org.jboss.soa.esb.filter.2" value="org.jboss.internal.soa.esb.message.filter.GatewayFilter" />
                         </properties>
                         </esb>
                        


                        So do i need to do any other settings in SOA platform. There is a mail-service.xml in deploy folder of my Jboss application server.What does this do?Is something to be set here also?