1 Reply Latest reply on Apr 6, 2012 1:24 AM by rose_hy119

    Seam 2.0 has problem sending mail with Icefaces 1.7

    rose_hy119 Newbie

      First, please forgive me still using such old version seam and Icefaces.

       

      What I am encountering is I get below exception when I sending mail by using seam mail component.

      Java Code:

       

      
      @In(create = true)
      
      
      private Renderer renderer;
      
      
      
      
      public void sendEmail() {
      
      
      
      
      try {
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      renderer.render("/test.xhtml");
      
      
      
      
      } catch (Exception e) {
      
      
      
      
      
      
      e.printStackTrace();
      
      
      
      
      }
      
      
      }
      
      

       

       

      Exception:

       

      java.lang.UnsupportedOperationException
          at javax.faces.context.ExternalContext.getResponseContentType(ExternalContext.java:749)
          at com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:183)
          at com.icesoft.faces.renderkit.D2DRenderKit.createResponseWriter(D2DRenderKit.java:82)
          at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.init(FaceletsRenderer.java:104)
          at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.run(FaceletsRenderer.java:77)
          at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:169)
          at com.victor.web.bean.PatientBean.sendEmail(PatientBean.java:52)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
          at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
          at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
          at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
          at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
          at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
          at com.victor.web.bean.PatientBean_$$_javassist_3.sendEmail(PatientBean_$$_javassist_3.java)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
          at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
          at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
          at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
          at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
          at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
          at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
          at javax.faces.component.UICommand.broadcast(UICommand.java:383)
          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
          at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
          at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
          at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
          at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:94)
          at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:54)
          at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:26)
          at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
          at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
          at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38)
          at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
          at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
          at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55)
          at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:19)
          at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
          at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
          at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
          at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
          at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
          at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
      

       

      My component.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
          xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
          xmlns:transaction="http://jboss.com/products/seam/transaction"
          xmlns:mail="http://jboss.com/products/seam/mail" 
          xmlns:security="http://jboss.com/products/seam/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:spring="http://jboss.com/products/seam/spring" xmlns:web="http://jboss.com/products/seam/web"
          xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd 
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd 
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
                       http://jboss.com/products/seam/spring
                       http://jboss.com/products/seam/spring-2.0.xsd
                       http://jboss.com/products/seam/mail
                       http://jboss.com/products/seam/mail-2.1.xsd
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd">
      
          <core:manager conversation-timeout="120000"
              concurrent-request-timeout="500" conversation-id-parameter="cid" />
      
          <core:init transaction-management-enabled="true" />
      
          <transaction:entity-transaction
              entity-manager="#{entityManager}" />
      
          <persistence:entity-manager-factory
              name="entityManagerFactory" persistence-unit-name="eyePersistenceUnit" />
      
          <persistence:managed-persistence-context
              name="entityManager" auto-create="true" entity-manager-factory="#{entityManagerFactory}" />
      
          <component scope="APPLICATION" auto-create="true" name="renderManager"
              class="com.icesoft.faces.async.render.RenderManager" />
          <mail:mail-session host="smtp.gmail.com" password="****" port="465" username="*****" />
      </components>
      

       

      faces-config.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
          <application>
              <view-handler>
                  com.icesoft.faces.facelets.D2DSeamFaceletViewHandler
              </view-handler>
              <el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver>
              <locale-config>
                  <default-locale>en</default-locale>
              </locale-config>
          </application> 
      </faces-config>
      

      text.xhtml

       

      <m:message charset="UTF-8" xmlns="http://www.w3.org/1999/xhtml"
          xmlns:m="http://jboss.com/products/seam/mail">
      
          <m:from name="***" address="****" />
          <m:to name="**">******</m:to>
          <m:subject>Find your password!</m:subject>
          <m:body>
              <p>dear adrienne:</p>
              <p>your password is 133444!</p>
              <br />
              <p>This email is sended by system.Any question,please contact
                  administrator!</p>
          </m:body>
      </m:message>
      

       

      I'm not sure what mistake I make to get such exceptions. Can someone help me out?