Announcement Announcement Module
No announcement yet.
Spring Mail support getting test failure while running out side eclipse. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Mail support getting test failure while running out side eclipse.

    Hi spring guys,

    I am using spring mail support.

    I am getting an strange problem, while i am running my test case for my mail service inside eclipse its running fine while running it from maven through console its showing build failure and giving error.

    I am using spring 2.5.5. and java (1.5.0_15) dependency for maven pom is


    and java mail 1.3.3 with activation 1.0.2

    I think this is a jar issue. Can any body help me which jars are supportable for this.

    Let me know if any solution or i should arise this issue on jira.

    I have attached my stack trace file.

    Shakil Akhtar

  • #2
    I think the error message is quite obvious.

    java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport

    You're missing activation.jar or you're using old/wrong version which does not contain LogSupport class.

    You mentioned that this is a test class. Do mean by "test class" a unit test class or just a "test" class? In unit tests it's not recommended that the unit tests have dependencies to external resources like smtp server etc.... this is just a side note


    • #3
      Hi Noon,

      Thanks for replying,

      Unit test i.e Junit i have written for my MailManager class that is using spring and velocity in that its running fine in eclipse on run as junit and even sending emails.
      but when i do maven build it shows this error.

      if you have used spring 2.5.5 can you tell me which activation and java mail version with jdk 1.5.0_15 i should use to make maven build fine so that my junit test case will run fine.

      i got this problem before this module in my project so for my first release i have to go with pure java mail.

      Because spring is providing excellent mail support so i want to go with that.

      Here is my mail manager.

      public class MailManager

      private static final Log LOG = LogFactory

      private JavaMailSender mailSender;

      private String subject;

      private String from;

      private VelocityEngine velocityEngine;

      private String templateFile;

      public void sendMail(final AlertNotification alertNotification,
      final String[] toAddresses)throws MessagingException
      MimeMessagePreparator preparator = new MimeMessagePreparator() {
      public void prepare(MimeMessage mimeMessage) throws MessagingException
      MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
      Map model = new HashMap();
      model.put("alertNotification", alertNotification);
      String text = VelocityEngineUtils.mergeTemplateIntoString(
      velocityEngine, templateFile, model);
      message.setText(text, true);

      public void setVelocityEngine(VelocityEngine velocityEngn)
      this.velocityEngine = velocityEngn;

      public void setTemplateFile(String file)
      this.templateFile = file;

      public void setMailSender(JavaMailSender sender)
      this.mailSender = sender;

      public void setSubject(String sbjct)
      this.subject = sbjct;

      public void setFrom(String frm)
      this.from = frm;

      please help me its urgent for release to take decision for java mail or spring mail.

      thanks in advance.
      Last edited by Akhtar; Nov 2nd, 2008, 10:01 PM.


      • #4
        I think you should use activation 1.1. version instead of the 1.0.2. since the com/sun/activation/registries/LogSupport class exists only in 1.1. version (not in 1.0.2).

        This doesn't explain why it's working in Eclipse. I think Eclipse finds it from other JAR in your classpath??