1 Reply Latest reply on Jul 20, 2009 4:07 PM by Prathamesh Gaddam

    Error: Cannot set org.jboss.seam.mail.MailSession field!

    Prathamesh Gaddam Novice
      Dear Team,

      I'm gettting the above error towards:

      @Name("mailer")
      @Install(precedence=Install.FRAMEWORK)
      public class Mailer {
           @In
           MailSession mailSession;
           
           @Logger
           private Log log;
           
           public void sendMail() {
                
                try {
                     System.out.println("mailSession.getSession(): "+mailSession.getSession());
                     log.debug("VALUE: Mailer.sendMail():",mailSession.getSession());
                     Message message = new MimeMessage(mailSession.getSession());

      .
      .          } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                }
           }
      }

      And component.xml:

           <mail:mail-session
                     host="myHost.com"
                     password="password"
                     port="25"
                     username="emailId"/>

      Please assist to resolve it. Thank you in advance.

      Exceptions:

      Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: Mailer.mailSession on: workout.Mailer with value: class javax.mail.Session
           at org.jboss.seam.util.Reflections.set(Reflections.java:86)
           at org.jboss.seam.Component.setFieldValue(Component.java:1923)
           ... 75 more
      Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.mail.MailSession field workout.Mailer.mailSession to javax.mail.Session
           at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
           at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
           at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
           at java.lang.reflect.Field.set(Field.java:657)
           at org.jboss.seam.util.Reflections.set(Reflections.java:71)
           ... 76 more