3 Replies Latest reply on Dec 1, 2009 4:02 PM by Robert Hare

    Seam Mail Configuration Problem

    Pulkit Mehra Newbie
      Hi Freinds,

      I am using seam 2.1 + JSF 1.2 + Richfaces 3.2.2 and JBoss 4.2.1 .I configured Seam mail utility in  my project.

      I am using JNDI provided mail Session

      1)
      My mail-service.xml :

      <server>
        <mbean code="org.jboss.mail.MailService"
               name="jboss:service=Mail">
          <attribute name="JNDIName">java:/Mail</attribute>
          <attribute name="User">[EMAIL PROTECTED]</attribute>
          <attribute name="Password">anything</attribute>

          <attribute name="Configuration">
            <configuration>
              <property name="mail.transport.protocol" value="smtp"/>
              <property name="mail.user" value="[EMAIL PROTECTED]"/>
              <property name="mail.pop3.host" value="smtp.gmail.com"/>
              <property name="mail.smtp.port" value="465"/>
              <property name="mail.from" value="[EMAIL PROTECTED]"/>
              <property name="mail.smtp.auth" value="true"/>
              <property name="mail.smtp.starttls.enable" value="true"/>
              <property name="mail.debug" value="false"/>
            </configuration>
          </attribute>

          <depends>jboss:service=Naming</depends>
        </mbean>
      </server>


      2) components.xml

        <mail:mail-session session-jndi-name="java:/Mail"/>


      3)  Email Template :(EmailFormat.xhtml)

      <m:message xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:m="http://jboss.com/products/seam/mail"
                 importance="normal">
          <m:header name="X-Composed-By" value="JBoss Seam"/>
          <m:from name="ecanocsystem@gmail.com" address="ecanocsystem@gmail.com"/>

          <m:replyTo address="ecanocsystem@gmail.com"/>
          <m:to name="Pulkit" address="pulkit.mehra@newgen.co.in"></ m:to>
          <m:subject>New Subject</m:subject>
          <m:body type="plain">

      Hi Pulkit

          </m:body>
      </m:message>


      4) My Backing Seam Component :

      import org.jboss.seam.faces.Renderer;

      @Stateful
      @Name("appointmentContext")
      @Scope(ScopeType.SESSION)

      public class AppointmentContextBean implements AppointmentContext {

          @In
          Renderer  renderer;

           public void sendMail(){
              try {
                  renderer.render("EmailFormat.xhtml");
                  System.out.println("email sent successfully");
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
         
          @Remove
          @Destroy
          public void removeDestroy(){
                     
              }
      }


      =================================================================

      My Problem :

      When i invoke send mail method from an xhtml(<h:commandButton> submit) i get following exception.


      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalAccessError: tried to access method javax.mail.internet.MimeUtility.unfold(Ljava/lang/St
          javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
              at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
              at javax.faces.component.UICommand.broadcast(UICommand.java:383)
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
              at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
              at

      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalAccessError: tried to access method javax.mail.internet.MimeUtility.unfold(Ljava/lang/String;)Ljava/lang/String;
              at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
              at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
              at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
              at

      javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
              ... 56 more
      Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: tried to access method javax.mail.internet.MimeUtility.unfold(Ljava/lang/String;)Ljava/lang/String; from class org.jb
              at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
              at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at

      ===================================================================================

      I am new to Seam framework .Any reply would be appreciated.
      Thanks in Advance.

      Best Regards,
      Pulkit