Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    velocity <mail> problem in Power nightly 05-31-2011

    Hello,

    I want to send an email upon insertion of a record, using the marvellous Velocity operation binding. Before this I was using an oldschool 'Emailer.java' like class that was using javax.mail.Message internally, and I would call this class from Java on the server side.

    This oldschool method works, but if I use the same configuration for the velocity <mail> operationBinding, it gives the following error (I obscured the hostname etc):
    Code:
    === 2011-05-31 19:08:58,301 [l0-4] INFO  MailMessage - trying to connect to mail.somedomain.com
    === 2011-05-31 19:10:13,003 [l0-4] ERROR MailMessage - no smtp servers available, I tried: mail.somedomain.com
    
    java.lang.Exception: no SMTP servers available
    	at com.isomorphic.mail.MailMessage.initMessage(MailMessage.java:460)
    	at com.isomorphic.mail.MailMessage.buildMessage(MailMessage.java:320)
    	at com.isomorphic.mail.TemplatedMailMessage.buildMessage(TemplatedMailMessage.java:239)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1888)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    	at nl.sytematic.projects.Technicom.server.security.SecureIDACall.processRequest(SecureIDACall.java:125)
    This is my .ds.xml code (emailaddresses changed into something random):
    Code:
        <operationBinding operationType="add"> 
          <mail> 
            <from>test@test.nl</from>  
            <to>someEmail@someDomain.com</to>  
            <messageTemplate>Test</messageTemplate>  
            <subject>test</subject> 
          </mail> 
        </operationBinding>
    And this is my server.properties snippet:
    Code:
    ...
    #--- mail settings for use in the <mail> tags in .ds.xml files
    mail.system.mail.smtp.submitter:noreply@somedomain.com
    mail.system.mail.smtp.auth:true
    mail.system.mail.smtp.host:mail.somehost.com
    mail.system.mail.smtp.port:587
    mail.system.mail.smtp.user:someuser
    mail.system.mail.smtp.password:somepassword
    ...
    Now, when running the app, my oldskool servlet class just works. So the smtp actually is not down.

    Any idea what can be causing this? Am I forgetting some configuration things?
    Last edited by Sytematic; 31 May 2011, 09:32.

    #2
    This error is also reported if the credentials are rejected if you are using credentials (mail.smtp.auth is true). Are you using credentails and are they correct?

    If you already know how to use such tools, Wireshark can show you exactly what's going on.

    Comment


      #3
      Yeah credentials are the same as my other properties file (that is used by my Emailer.java class), which works. (checked like 10 times now to not make a fool of my self and waste your time)

      It hangs for a time before throwing this error by the way, as in it is not immediatly failing, but timing out, it seems.

      Since I cannot look into the code it's hard for me to debug my problem, unfortunately...

      Comment


        #4
        You have the same tools we'd use at your disposal: if this was happening here, we'd use Wireshark too.

        Timing out is strange, that really suggests a connection-level issue - have you tried providing the IP instead of the hostname?

        Do you get a different behavior if auth is disabled, or if the credentials are intentionally set wrongly?

        Comment


          #5
          Alright, that makes sense. Thanks for the quick reply.

          Intentionally putting the wrong password in let's it hang, same as with good credentials.
          Same story with putting 'auth' to false.

          Now trying ip...
          ...
          === 2011-05-31 20:52:57,756 [l0-5] INFO MailMessage - trying to connect to 93.186.178.11

          Also hangs...

          and a normal ping to both ip and hostname actually works (you could try if you want :-))


          What else / direction should I be looking?
          Last edited by Sytematic; 31 May 2011, 10:54.

          Comment


            #6
            Used Wireshark to look around things, and it appears that it is using port 25 while I specified 587 as port to be used.

            So it seems that:
            Code:
            mail.system.mail.smtp.port:587
            is not picked up.

            However, if I use my oldschool method FIRST, and THEN your method (ie. in the same session, without restarting the server, and by the same user) it works, because then the port IS correctly set.

            my app contains both methods at the moment, but I want to switch to velocity style.

            Is this a regression in your code that does not init the port correctly if it's not 25?

            Comment


              #7
              Hmm, this was a strange one. Our code is doing the right thing by setting up a Properties object with defaults read from the server.properties file; but Javamail is not falling back to using those defaults, for some reason. We've now worked around this seeming bug in Javamail - please try tomorrow's nightly build.

              Comment


                #8
                Alright, thanks for the investigation. Will try.

                Comment

                Working...
                X