spring - java.lang.IllegalArgumentException: The 'original' message argument cannot be null -


i'm trying send email using spring. @ code:

public class provider {      private mailsender mailsender;     private simplemailmessage message;      public void setmailsender(mailsender mailsender) {         this.mailsender = mailsender;     }      public void setmessage(simplemailmessage message) {         this.message = message;     }      public static string gettemplatename() {         return "mainlayout/layout.jsp";     }       public void placeorder() {          // ... * business calculations....         // ... * call collaborators persist order          // create thread safe "sandbox" of message         simplemailmessage msg = new simplemailmessage(this.message);         msg.setto("babobka@bk.ru");         msg.settext("hello");         try {             mailsender.send(msg);         } catch (mailexception ex) {             // log , go on             system.err.println(ex.getmessage());         }     }  } 

don't know why it's not working. have no idea what's wrong. added depencies mail.

simplemailmessage msg = new simplemailmessage(this.message); 

i think this.message null.you should initialize first.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -