Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.mail.MailSendException not working properly? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.mail.MailSendException not working properly?

    hi,

    when i try to send mails with spring mailsender and i set the mail host to a wrong address, the exception which is thrown by spring (org.springframework.mail.MailSendException) doesn't work properly because the exception itself causes a java.lang.NullPointerException.

    springcontext:
    Code:
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
      		<property name="host" value="non.existing.host"/>
    </bean>
    stack:
    Code:
    java.lang.NullPointerException
    	at org.springframework.mail.MailSendException.toString(MailSendException.java:124)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at java.lang.Throwable.printStackTraceAsCause(Unknown Source)
    	at java.lang.Throwable.printStackTrace(Unknown Source)
    	at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:59)
    	at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:342)
    	at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:304)
    	at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
    	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
    	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
    	at org.apache.log4j.Category.callAppenders(Category.java:203)
    	at org.apache.log4j.Category.forcedLog(Category.java:388)
    	at org.apache.log4j.Category.log(Category.java:853)
    	at org.apache.commons.logging.impl.Log4JLogger.warn(Log4JLogger.java:228)
    	at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:79)
    	at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
    	at java.util.TimerThread.mainLoop(Unknown Source)
    	at java.util.TimerThread.run(Unknown Source)
    error occurs when i try:
    this.mailSender.send(msg);

    problem is i would really like to have the real exception thrown to provide optimal feedback for the user.

    is this a known issue in spring? or am i doing something wrong?

    greets, tony

  • #2
    I assume you are using Spring 2.5? This appears to be a bug. There was a similar issue reported in JIRA yesterday, and I've updated it to include your details:

    http://opensource.atlassian.com/proj...rowse/SPR-4138

    Comment


    • #3
      hi mike,

      thanks for your reply. your assumption is correct, it is spring 2.5.

      Comment

      Working...
      X