<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "A fix for Seam mail"]]></title>
		<link>http://www.icefaces.org/JForum/posts/list/22.page</link>
		<description><![CDATA[Latest messages posted in the topic "A fix for Seam mail"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ Hi all,

Like more than a few others I have been wanting to use Seam mail alongside IceFaces for a while now, but it doesn't work.  There is a workaround now apparently by using just-ice.jar but I created my own fix before I came across this.  Anyway, I thought I'd share my fix.

What I have done is take the AsynchronousMailProcessor class from the mail example from the Seam examples and added a workaround for the IceFaces compatibility issue.

The workaround involves messing with the FacesContext and its viewroot (it resets them when the email is done) so unfortunately it can't access your Seam contexts directly.  I get around this by passing the emailer a hashmap of context items I want in the new context.

To send an email is pretty simple.  First inject the mailProcessor component then call scheduleEmailSend.

e.g. from the forgotPassword handler in my current project
	@In
	private AsynchronousIceFacesMailProcessor asynchronousMailProcessor;
...

private void sendForgotEmail()
{
  String template = "/templates/emails/forgotpassword.xhtml";
  User user = getUser();

  HashMap<String, Object> contextMap = new HashMap<String, Object>();
  contextMap.put("user", user);
  contextMap.put("password", user.resetPassword());

  // schedule the email to be sent 5000ms from now
  asynchronousMailProcessor.scheduleEmailSend(5000, template, contextMap);

}


Feel free to use this however you like.  It's been working well for me for a while now but I only abstracted it to the point that it was divorced my my clients code (allowing me to share it) today.  I won't offer any support for it but if you have issues you can certainly send me an email and I'll take a look when I can.  If anyone wants to modify / improve upon it also feel free, just let me know so I can reap the benefits too.

Enjoy.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#33826</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#33826</link>
				<pubDate><![CDATA[Wed, 23 Apr 2008 23:29:41]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Whoops!

My aplogies to anyone who downloaded the code over the last couple of days.  I just realized that I posted an old version.  Sorry, my bad.  I was working on a released branch of my own project rather than the trunk and didn't think about that when I uploaded the file.

The version I uploaded previously was my first attempt, which did get Seam mail working and you could do basic EL expressions but faces tags would not work due to an instanceof check in the IceFaces renderer.  i.e. you could do Dear #{person.firstname}  but not Dear <h:outputText value="#{person.firstname}"/>

Anyway, the version attached here fixes that.  You still can't do Icefaces tags but basic faces tags should work fine, at least the ones I've tested.

Again, sorry for the confusion.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#33968</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#33968</link>
				<pubDate><![CDATA[Sun, 27 Apr 2008 01:00:42]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ Hi,

I have some trouble getting your solution to run. Whenever the mail processor is called I get a java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory.

Do I have to deploy some additional jars?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#34606</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#34606</link>
				<pubDate><![CDATA[Mon, 12 May 2008 09:14:42]]> GMT</pubDate>
				<author><![CDATA[ yocasper]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I actually saw that exception the first time I tested this, but it disappeared the next time I deployed and I haven't seen it since.  If you can reproduce it let me know and post some details and I'll see if I can figure it out.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#34630</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#34630</link>
				<pubDate><![CDATA[Mon, 12 May 2008 13:03:29]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I am running your example without any changes using Seam 2.0.1 and ICEfaces 1.7 on JBoss 4.2.2. 

My components.xml looks like:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
&lt;components ...&gt;
   &lt;core:init debug="@debug@" jndi-pattern="@jndiPattern@"/&gt;
     
   &lt;component scope="APPLICATION" auto-create="true" name="renderManager" class="com.icesoft.faces.async.render.RenderManager" /&gt;

   &lt;core:manager concurrent-request-timeout="500" 
                 conversation-timeout="120000" 
                 conversation-id-parameter="cid"/&gt;
    
   &lt;persistence:managed-persistence-context name="entityManager"
                                     auto-create="true"
                      persistence-unit-jndi-name="java:/mjunetiEntityManagerFactory"/&gt;

   &lt;drools:rule-base name="securityRules"&gt;
       &lt;drools:rule-files&gt;
           &lt;value&gt;/security.drl&lt;/value&gt;
       &lt;/drools:rule-files&gt;
   &lt;/drools:rule-base&gt;

   &lt;security:identity authenticate-method="#{authenticator.authenticate}"
                           security-rules="#{securityRules}"/&gt;
   
   &lt;event type="org.jboss.seam.security.notLoggedIn"&gt;
       &lt;action execute="#{redirect.captureCurrentView}"/&gt;
   &lt;/event&gt;
   
   &lt;event type="org.jboss.seam.security.loginSuccessful"&gt;
       &lt;action execute="#{redirect.returnToCapturedView}"/&gt;
   &lt;/event&gt;
   
   &lt;!-- Install the QuartzDispatcher --&gt;
   &lt;async:quartz-dispatcher/&gt;
   
   &lt;!-- Configure Mail --&gt;
   &lt;mail:mail-session host="localhost" port="2525" username="yocasper" password="*******" /&gt;
   
   &lt;!-- uncomment this one and set the host attribute to the name or IP address of your SMTP gateway--&gt;
   &lt;!-- &lt;mail:mail-session host="smtp.foo.com" /&gt;--&gt;
   
   &lt;!-- Configure meldware --&gt;
   &lt;mail:meldware&gt;
   	&lt;mail:users&gt;
   		&lt;value&gt;#{meldwareUser.yocasper}&lt;/value&gt;
	&lt;/mail:users&gt;
   &lt;/mail:meldware&gt;
   
   &lt;!-- Meldware users --&gt;
   
   &lt;mail:meldware-user name="meldwareUser.yocasper" username="yocasper" password="********" /&gt;  
      
&lt;/components&gt;
</pre>
		</div>

and web.xml:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
&lt;web-app version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee"
         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-app_2_5.xsd"&gt;
    
    &lt;!-- Seam &#40;using Icefaces&#41; generated project--&gt;
    
    &lt;!-- listeners required for this application --&gt; 
    &lt;listener&gt;
        &lt;listener-class&gt;org.jboss.seam.servlet.SeamListener&lt;/listener-class&gt;
    &lt;/listener&gt;

    &lt;listener&gt;
        &lt;listener-class&gt;com.icesoft.faces.util.event.servlet.ContextEventRepeater&lt;/listener-class&gt;
    &lt;/listener&gt;

    
    &lt;!-- filters --&gt;
    &lt;filter&gt;
        &lt;filter-name&gt;Seam Filter&lt;/filter-name&gt;
        &lt;filter-class&gt;org.jboss.seam.servlet.SeamFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
    
    &lt;filter-mapping&gt;
        &lt;filter-name&gt;Seam Filter&lt;/filter-name&gt;
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    
     &lt;filter&gt;
        &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
        &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;

 		 &lt;!-- set the amount of seconds the conf file will be checked for reload
        can be a valid integer &#40;0 denotes check every time,
        -1 denotes no reload check, default -1&#41; --&gt;
        &lt;init-param&gt;
            &lt;param-name&gt;confReloadCheckInterval&lt;/param-name&gt;
            &lt;param-value&gt;0&lt;/param-value&gt;
        &lt;/init-param&gt;
 		      
        &lt;init-param&gt;
            &lt;param-name&gt;logLevel&lt;/param-name&gt;
            &lt;param-value&gt;WARN&lt;/param-value&gt;
        &lt;/init-param&gt;
         &lt;!--
        &lt;init-param&gt;
            &lt;param-name&gt;statusPath&lt;/param-name&gt;
            &lt;param-value&gt;/status&lt;/param-value&gt;
        &lt;/init-param&gt;
        --&gt;
        
    &lt;/filter&gt;
    
    &lt;filter-mapping&gt;
        &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
     
    &lt;context-param&gt;
        &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
        &lt;param-value&gt;server&lt;/param-value&gt;
    &lt;/context-param&gt;
    
    &lt;!-- Facelets development mode &#40;disable in production&#41; --&gt;
    &lt;context-param&gt;
        &lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    
    &lt;context-param&gt;
        &lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;
        &lt;param-value&gt;.xhtml&lt;/param-value&gt;
    &lt;/context-param&gt;
    
    &lt;context-param&gt;
        &lt;param-name&gt;com.icesoft.faces.actionURLSuffix&lt;/param-name&gt;
        &lt;param-value&gt;.seam&lt;/param-value&gt;
    &lt;/context-param&gt;
    
    &lt;context-param&gt;
        &lt;param-name&gt;com.icesoft.faces.synchronousUpdate&lt;/param-name&gt;
        &lt;param-value&gt;false&lt;/param-value&gt;
    &lt;/context-param&gt;

    &lt;context-param&gt; 
        &lt;param-name&gt;com.icesoft.faces.doJSFStateManagement&lt;/param-name&gt;
	&lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt; 

    &lt;context-param&gt;
        &lt;param-name&gt;org.icesoft.examples.serverClock&lt;/param-name&gt;
        &lt;param-value&gt;false&lt;/param-value&gt;
    &lt;/context-param&gt;

    &lt;context-param&gt;
        &lt;param-name&gt;com.icesoft.faces.standardRequestScope&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    
    &lt;!-- servlets --&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    
    &lt;servlet&gt;
        &lt;servlet-name&gt;Seam Resource Servlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.jboss.seam.servlet.ResourceServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    
    &lt;servlet&gt;
        &lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;Blocking Servlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;com.icesoft.faces.webapp.xmlhttp.BlockingServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;
    &lt;/servlet&gt;  
    

    &lt;!-- servlet mappings --&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;*.seam&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    
     &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/xmlhttp/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    
    &lt;!-- Blocking Servlet Mapping --&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Blocking Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/block/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
             
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Seam Resource Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/seam/resource/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    
    &lt;security-constraint&gt; 
        &lt;display-name&gt;Restrict raw XHTML Documents&lt;/display-name&gt;
        &lt;web-resource-collection&gt;
            &lt;web-resource-name&gt;XHTML&lt;/web-resource-name&gt;
            &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
        &lt;/web-resource-collection&gt;
        &lt;auth-constraint&gt;
            &lt;role-name&gt;NONE&lt;/role-name&gt;
        &lt;/auth-constraint&gt;
    &lt;/security-constraint&gt;
    
&lt;/web-app&gt;
</pre>
		</div>

My faces-config.xml looks like:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
&lt;faces-config&gt;

   &lt;application&gt;
      &lt;message-bundle&gt;messages&lt;/message-bundle&gt;
      &lt;locale-config&gt;
         &lt;default-locale&gt;de_DE&lt;/default-locale&gt;
         &lt;supported-locale&gt;de_DE&lt;/supported-locale&gt;
         &lt;supported-locale&gt;de_AT&lt;/supported-locale&gt;
         &lt;supported-locale&gt;de_CH&lt;/supported-locale&gt;
      &lt;/locale-config&gt;
      &lt;view-handler&gt;com.icesoft.faces.facelets.D2DSeamFaceletViewHandler&lt;/view-handler&gt;
   &lt;/application&gt;

&lt;/faces-config&gt;
</pre>
		</div>

I call the scheduleEmailSend method from the class you provided like this:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
Map&lt;String, Object&gt; context = new HashMap&lt;String, Object&gt;&#40;&#41;;
context.put&#40;"registeredUser", body&#41;;
asynchronousMailProcessor.scheduleEmailSend&#40;300, "/WEB-INF/mailtemplates/confirmationRegistration.xhtml", context&#41;;
</pre>
		</div>

After a moment the stack trace gets noisy:
07:10:08,184 ERROR [JobRunShell] Job DEFAULT.22bc6e12:119e0adfd98:-7fbd threw an unhandled Exception: 
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
	at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
	at com.icesoft.faces.context.BridgeFacesContext.<init>(BridgeFacesContext.java:99)
	at com.mjuneti.core.mail.AsynchronousMailProcessor$MockBridgeFacesContext.<init>(AsynchronousMailProcessor.java:170)
	at com.mjuneti.core.mail.AsynchronousMailProcessor$Context.wrap(AsynchronousMailProcessor.java:123)
	at com.mjuneti.core.mail.AsynchronousMailProcessor.scheduleEmailSend(AsynchronousMailProcessor.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	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.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:50)
	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.mjuneti.core.mail.AsynchronousMailProcessor_$$_javassist_4.scheduleEmailSend(AsynchronousMailProcessor_$$_javassist_4.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
	at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
	at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
	at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
	at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:240)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
07:10:08,185 ERROR [ErrorLogger] Job (DEFAULT.22bc6e12:119e0adfd98:-7fbd threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:214)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
* Nested Exception (Underlying Cause) ---------------
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
	at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
	at com.icesoft.faces.context.BridgeFacesContext.<init>(BridgeFacesContext.java:99)
	at com.mjuneti.core.mail.AsynchronousMailProcessor$MockBridgeFacesContext.<init>(AsynchronousMailProcessor.java:170)
	at com.mjuneti.core.mail.AsynchronousMailProcessor$Context.wrap(AsynchronousMailProcessor.java:123)
	at com.mjuneti.core.mail.AsynchronousMailProcessor.scheduleEmailSend(AsynchronousMailProcessor.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	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.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:50)
	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.mjuneti.core.mail.AsynchronousMailProcessor_$$_javassist_4.scheduleEmailSend(AsynchronousMailProcessor_$$_javassist_4.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
	at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
	at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
	at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
	at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:240)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)


I tried deploying it a couple times but the error didn't disappear. I tried several other things too without any success. 
I would really appreciate your help on this. 

]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#34646</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#34646</link>
				<pubDate><![CDATA[Tue, 13 May 2008 00:28:34]]> GMT</pubDate>
				<author><![CDATA[ yocasper]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I haven't had much time to look at this due to a tight deadline at work.  I did some quick tests but couldn't duplicate the error.  I would think something like this would fix it though:

In the wrap method right before the MockBridgeFacesContext is created, try setting the application factory.

The code would look like this:

if (PersistentFacesState.getInstance() != null) {
...
}
else {
    try {
        FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY));
    } catch (IllegalStateException ex) {
        FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
				 "com.sun.faces.mock.MockApplicationFactory");
    }

    BridgeFacesContext bfc = new MockBridgeFacesContext(viewId);		    bfc.setCurrentInstance();
}

Let me know if that works for you.  If it does I will add it to the code.  If not I will try to get some time to investigate it this week.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#35449</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#35449</link>
				<pubDate><![CDATA[Mon, 26 May 2008 14:49:53]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I have tried @gstacey's fix and it worked great for Seam-2.0.0.GA, but requires some modification for 2.0.1.GA and 2.0.2.GA.  

Working with the seam trunk (this is not backwards-compatible and required some change to seam to get working--Thanks to Pete Muir), we now have an example of how to use jsf-delegation with seam-mail to get it working.  There is an attachment to <a href="http://jira.icefaces.org/browse/ICE-2321" target="_new" rel="nofollow">jira ICE-2321</a> that you can drop into a recent download of seam trunk (2.1.0) that works using jsf-delegation and ICEfaces.  You will need to set icefaces.home to your local icefaces installation as it uses just-ice.jar instead of icefaces.jar.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#35502</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#35502</link>
				<pubDate><![CDATA[Tue, 27 May 2008 14:31:38]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I finally got some time to investigate this issue, sorry for the slow response.

It looks like there is some issue with Seam and Quartz involved.  The code works fine for me with the default scheduler but not with Quartz.  I found mention of a similar Quartz issue on the Seam forums
<a href='http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116377&postdays=0&postorder=asc&start=0' target='_new' rel="nofollow">http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116377&postdays=0&postorder=asc&start=0</a>

Anyway, I worked out a solution for this also and have attached it.  This has been tested in Seam2.0.2SP1 and JBoss 4.2.2]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#35824</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#35824</link>
				<pubDate><![CDATA[Wed, 4 Jun 2008 00:07:35]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ @gstacey...why don't you attach this class with a comment to the jira?  That way, depending on the version of Seam, we will have (most) of it covered. (ICE-2321).  They can either use your Class (for the pre jboss-seam-2.1.0) or jsf-delegation like in the example attached to the jira.
Thanks for your efforts!]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#35859</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#35859</link>
				<pubDate><![CDATA[Wed, 4 Jun 2008 09:22:28]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I've attached my workaround for this issuein the JIRA]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#35871</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#35871</link>
				<pubDate><![CDATA[Wed, 4 Jun 2008 10:34:39]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Hi gstacey,

first I want to thank you for this solution. I was astonished that the only workaround to use Seam mailing was to use an unreleased Seam version and just-ice.jar. But you showed that there's another way.

I've modified your version this way:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>@Asynchronous
	public void scheduleEmailSend&#40;@Duration
	long delay, String template, HashMap&lt;String, Object&gt; contextMap&#41; {
		// emailSend&#40;template, contextMap&#41;;
		// }
		//	
		// public void emailSend&#40;String template, HashMap&lt;String, Object&gt;
		// contextMap&#41; {
//.....
			
		}
		catch &#40;IOException e&#41; {
			log.error&#40;"AsynchronousMailProcessor::emailSend exception - " + e.getMessage&#40;&#41;&#41;;
			throw new RuntimeException&#40;e&#41;;
		}
		finally {
			context.unwrap&#40;&#41;;
		}
	}</pre>
		</div>

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>@Asynchronous
	public void scheduleEmailSend&#40;@Duration
	long delay, String template, HashMap&lt;String, Object&gt; contextMap&#41; {
		// emailSend&#40;template, contextMap&#41;;
		// }
		//	
		// public void emailSend&#40;String template, HashMap&lt;String, Object&gt;
		// contextMap&#41; {
//.....
			
		}
		catch &#40;Exception e&#41; {
			log.error&#40;"AsynchronousMailProcessor::emailSend exception - " + e.getMessage&#40;&#41;&#41;;
			throw new RuntimeException&#40;e&#41;;
		}
		finally {
			context.unwrap&#40;&#41;;
		}
	}</pre>
		</div>

I catch every exception since I had a mistake in my EL this code just did nothing. Neither do anything useful nor show an error.

After fixing my EL, I got this:
<p></p>

		<cite>log wrote:</cite><br>
		<blockquote>AsynchronousMailProcessor::emailSend exception - ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings&nbsp;
		</blockquote>

What could have caused this exception? I use JBoss AS 4.2.2 with Seam 2.0.1 and ICEfaces 1.7.1.
Here's my components.xml:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;components
	xmlns="http://jboss.com/products/seam/components"
	xmlns:core="http://jboss.com/products/seam/core"
	xmlns:mail="http://jboss.com/products/seam/mail"
	xmlns:persistence="http://jboss.com/products/seam/persistence"
	xmlns:security="http://jboss.com/products/seam/security"
	xmlns:transaction="http://jboss.com/products/seam/transaction"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://jboss.com/products/seam/core http://jboss.com/products/seam/core-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/persistence http://jboss.com/products/seam/persistence-2.0.xsd"&gt;
		&lt;core:init 	jndi-pattern="Ares-ear/#{ejbName}/local"
					transaction-management-enabled="true"
					debug="false"
					/&gt;
		
		&lt;core:manager	concurrent-request-timeout="500"
						conversation-id-parameter="cid"
						conversation-timeout="120000"
						/&gt;
		
		&lt;core:resource-loader&gt;
			&lt;core:bundle-names&gt;
				&lt;value&gt;com.idsscheer.ares.resources.ares_messages&lt;/value&gt;
			&lt;/core:bundle-names&gt;
		&lt;/core:resource-loader&gt;	
		
		&lt;transaction:ejb-transaction /&gt;
		
		&lt;persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:/entityManagerFactories/aresData"/&gt;
		
		&lt;security:identity authenticate-method="#{login.authenticate}" remember-me="false"/&gt;
		
		&lt;mail:mail-session host="mailhost.companydomaingoeshere.com" /&gt;
&lt;/components&gt;</pre>
		</div>

The web.xml:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>&lt;?xml version="1.0"?&gt;
	&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
		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-app_2_5.xsd"&gt;
		
 	&lt;!-- Facelets development mode &#40;disable in production&#41; --&gt;
 	&lt;context-param&gt;
  		&lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt;
  		&lt;param-value&gt;false&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	
 	&lt;!-- JSF --&gt;
 	&lt;context-param&gt;
 		&lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
 		&lt;param-value&gt;server&lt;/param-value&gt;
 	&lt;/context-param&gt;

 	&lt;context-param&gt;
  		&lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;
  		&lt;param-value&gt;.xhtml&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	
 	&lt;context-param&gt;
  		&lt;param-name&gt;com.icesoft.faces.actionURLSuffix&lt;/param-name&gt;
  		&lt;param-value&gt;.seam&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	&lt;context-param&gt;
 		&lt;param-name&gt;com.icesoft.faces.synchronousUpdate&lt;/param-name&gt;
 		&lt;param-value&gt;false&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	&lt;context-param&gt;
 		&lt;param-name&gt;com.icesoft.faces.doJSFStateManagement&lt;/param-name&gt;
 		&lt;param-value&gt;true&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	&lt;context-param&gt;
 		&lt;param-name&gt;com.icesoft.faces.standardRequestScope&lt;/param-name&gt;
 		&lt;param-value&gt;true&lt;/param-value&gt;
 	&lt;/context-param&gt;
 	
 	&lt;context-param&gt;
 		&lt;param-name&gt;com.sun.faces.enableRestoreView11Compatibility&lt;/param-name&gt;
 		&lt;param-value&gt;false&lt;/param-value&gt;&lt;!-- TODO: Was true before --&gt;
 	&lt;/context-param&gt;
 	
 	&lt;filter&gt;
 		&lt;filter-name&gt;Seam Filter&lt;/filter-name&gt;
 		&lt;filter-class&gt;org.jboss.seam.web.SeamFilter&lt;/filter-class&gt;
 	&lt;/filter&gt;
 	&lt;filter-mapping&gt;
 		&lt;filter-name&gt;Seam Filter&lt;/filter-name&gt;
 		&lt;url-pattern&gt;/*&lt;/url-pattern&gt;
 	&lt;/filter-mapping&gt;
 	
 	&lt;listener&gt;
 		&lt;listener-class&gt;org.jboss.seam.servlet.SeamListener&lt;/listener-class&gt;
 	&lt;/listener&gt;
 	
 	&lt;listener&gt;
 		&lt;listener-class&gt;com.icesoft.faces.util.event.servlet.ContextEventRepeater&lt;/listener-class&gt;
 	&lt;/listener&gt;
 	
 	&lt;!-- &lt;servlet&gt;
 		&lt;servlet-name&gt;Seam Resource Servlet&lt;/servlet-name&gt;
 		&lt;servlet-class&gt;org.jboss.seam.servlet.SeamResourceServlet&lt;/servlet-class&gt;
 	&lt;/servlet&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;Seam Resource Servlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;/seam/resource/*&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt; --&gt;
 	
 	&lt;servlet&gt;
 		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
 		&lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
 		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
 	&lt;/servlet&gt;
 	
 	&lt;servlet&gt;
 		&lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
 		&lt;servlet-class&gt;com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet&lt;/servlet-class&gt;
 		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
 	&lt;/servlet&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;*.seam&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;/inc/mail_developerAndValidator.xhtml&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;/xmlhttp/*&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt;
 	
 	&lt;servlet&gt;
 		&lt;servlet-name&gt;Blocking Servlet&lt;/servlet-name&gt;
 		&lt;servlet-class&gt;com.icesoft.faces.webapp.xmlhttp.BlockingServlet&lt;/servlet-class&gt;
 		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
 	&lt;/servlet&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;Blocking Servlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;/block/*&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt;
 	
 	&lt;servlet&gt;
 		&lt;servlet-name&gt;uploadServlet&lt;/servlet-name&gt;
 		&lt;servlet-class&gt;com.icesoft.faces.component.inputfile.FileUploadServlet&lt;/servlet-class&gt;
 		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
 	&lt;/servlet&gt;
 	&lt;servlet-mapping&gt;
 		&lt;servlet-name&gt;uploadServlet&lt;/servlet-name&gt;
 		&lt;url-pattern&gt;/uploadHtml&lt;/url-pattern&gt;
 	&lt;/servlet-mapping&gt;

 	&lt;servlet&gt;
		&lt;servlet-name&gt;fileServlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;com.idsscheer.ares.FileServlet&lt;/servlet-class&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;fileServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/downloadFile&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
 	
 	&lt;session-config&gt;
 		&lt;session-timeout&gt;5&lt;/session-timeout&gt;
 	&lt;/session-config&gt;
 &lt;/web-app&gt;</pre>
		</div>

As you can see, I already tried to map the Persistent Faces Servlet to the mail template. The mail template is here:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>&lt;ui:repeat value="#{statisticsToMail}" var="statistics_var"
		xmlns="http://www.w3.org/1999/xhtml"
    	xmlns:m="http://jboss.com/products/seam/mail"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"&gt;
	&lt;m:message importance="high"&gt;
  
    	&lt;m:from name="#{user.name}" address="#{user.email}" /&gt;
    	&lt;m:to name="#{statistics_var.user.name}"&gt;#{statistics_var.user.email}&lt;/m:to&gt;
    	&lt;m:subject&gt;Ares validates/errors are available for you&lt;/m:subject&gt;
    
	    &lt;m:body&gt;
    	    &lt;p&gt;&lt;h:outputText value="Hello #{statistics_var.user.name}," /&gt;&lt;/p&gt;
    	    
    	    &lt;p&gt;
    	    	&lt;h:outputText value="Ares shows that there are some" /&gt;
    	    	&lt;h:outputText value=" validates " rendered="#{statistics_var.sendVaildatorMail and !statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value=" errors " rendered="#{!statistics_var.sendVaildatorMail and statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value=" validates and errors " rendered="#{statistics_var.sendVaildatorMail and !statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value="you have to do:" /&gt;
    	    &lt;/p&gt;
    	    
    	    &lt;ul&gt;
    	    	&lt;li&gt;
    	    		&lt;h:outputText value="#{statistics_var.testactionsToValidate}" /&gt;
    	    		&lt;h:outputText value=" validates" /&gt;
    	    	&lt;/li&gt;
    	    	&lt;li&gt;
    	    		&lt;h:outputText value="#{statistics_var.errorsToBugfix}" /&gt;
    	    		&lt;h:outputText value=" errors" /&gt;
    	    	&lt;/li&gt;
    	    &lt;/ul&gt;
    	    
        	&lt;p&gt;&lt;h:outputText value="Please check Ares." /&gt;&lt;/p&gt;
        	 
        	&lt;p&gt;&lt;h:outputText value="Regards" /&gt;&lt;/p&gt;
        	&lt;p&gt;&lt;h:outputText value="Hello #{statistics_var.user.name}," /&gt;&lt;/p&gt;
        
        	&lt;f:facet name="alternative"&gt;
        		&lt;h:outputText value="Hello #{statistics_var.user.name}," /&gt;
        		
    	    	&lt;h:outputText value="Ares shows that there are some" /&gt;
    	    	&lt;h:outputText value=" validates " rendered="#{statistics_var.sendVaildatorMail and !statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value=" errors " rendered="#{!statistics_var.sendVaildatorMail and statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value=" validates and errors " rendered="#{statistics_var.sendVaildatorMail and !statistics_var.sendDeveloperMail}" /&gt;
    	    	&lt;h:outputText value="you have to do:" /&gt;
    	    
    	    	&lt;h:outputText value="- #{statistics_var.testactionsToValidate}" rendered="#{statistics_var.sendVaildatorMail}" /&gt;
   	    		&lt;h:outputText value=" validates" rendered="#{statistics_var.sendVaildatorMail}" /&gt;
   	    		&lt;h:outputText value="#{statistics_var.errorsToBugfix}" rendered="#{statistics_var.sendDeveloperMail}" /&gt;
   	    		&lt;h:outputText value=" errors" rendered="#{statistics_var.sendDeveloperMail}" /&gt;
    	    
        		&lt;h:outputText value="Please check Ares." /&gt;
        	 
        		&lt;h:outputText value="Regards" /&gt;
        		&lt;h:outputText value="Hello #{statistics_var.user.name}," /&gt;
			&lt;/f:facet&gt;
    	&lt;/m:body&gt;
	&lt;/m:message&gt;
&lt;/ui:repeat&gt;</pre>
		</div>

Thank you
Newlukai]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37068</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37068</link>
				<pubDate><![CDATA[Fri, 27 Jun 2008 07:27:12]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ The reason for my problem is simple. DOMResponseWriter tries to cast the context to a BridgeFacesContext, which fails, since the context is a MailFacesContextImpl.

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>public DOMResponseWriter&#40;FacesContext context, DOMSerializer serializer, Configuration configuration, Collection jsCode, Collection cssCode&#41; {
        this.serializer = serializer;
        this.configuration = configuration;
        this.jsCode = jsCode;
        this.cssCode = cssCode;
        try {
            this.context = &#40;BridgeFacesContext&#41; context;
        } catch &#40;ClassCastException e&#41; {
            throw new IllegalStateException&#40;
                    "ICEfaces requires the PersistentFacesServlet. " +
                            "Please check your web.xml servlet mappings"&#41;;
        }
        boolean streamWritingParam = configuration.getAttributeAsBoolean&#40;"streamWriting", false&#41;;
        isStreamWritingFlag = Beans.isDesignTime&#40;&#41; || streamWritingParam;
    }</pre>
		</div>

I'll see if I can figure out, what I'm doing wrong. Anyone using the AsynchronousIceFacesMailProcessor should get this error ... :S]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37071</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37071</link>
				<pubDate><![CDATA[Fri, 27 Jun 2008 08:07:21]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Ahhh. I got it. As soon as I introduce an <h:outputText /> I get this error. Is it possible to fix this?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37072</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37072</link>
				<pubDate><![CDATA[Fri, 27 Jun 2008 09:00:21]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Did you download the latest version (about halfway down this page)?  One of the earlier versions had a bug like you are describing...]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37090</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37090</link>
				<pubDate><![CDATA[Fri, 27 Jun 2008 16:10:49]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I downloaded the version from JIRA attached to the mentioned issue. Is it possible to use <h:outputText>? I would really like to use the render attributes.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37138</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37138</link>
				<pubDate><![CDATA[Mon, 30 Jun 2008 09:41:49]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Hmmm...

How are you calling the emailSend method?  Can you post the relevant code?  Also, what is the extra mapping for?
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
  	&lt;servlet-mapping&gt;
  		&lt;servlet-name&gt;Persistent Faces Servlet&lt;/servlet-name&gt;
  		&lt;url-pattern&gt;/inc/mail_developerAndValidator.xhtml&lt;/url-pattern&gt;
  	&lt;/servlet-mapping&gt;
</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37141</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37141</link>
				<pubDate><![CDATA[Mon, 30 Jun 2008 10:53:55]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Hi,

this extra mapping was for test purposes since I got an exception which told me that the Persistent Faces Servlet was needed. This mapping is already removed ;)

I have a page which shows a list of entries and each of this entry refers to a specific user of the system. Now you can use checkboxes to select entries and a button to send an email to the selected users. So I have a button:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>&lt;h:commandButton action="#{statistics.sendMails}" image="img/icon_buttonLine_sendMails.gif" styleClass="graphical" /&gt;</pre>
		</div>

which calls this method:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>@Stateful
@Scope&#40;ScopeType.SESSION&#41;
@Name&#40;"statistics"&#41;
public class StatisticsAction implements Statistics, Serializable {
  private static final long serialVersionUID = -2193510578285970349L;

  @PersistenceContext&#40;unitName = "aresDatabase"&#41;
  private transient EntityManager em;
  
  @In
  private User user;
  
  @In
  private AsynchronousIceFacesMailProcessor asynchronousMailProcessor; 
  
  public void sendMails&#40;&#41; {
//    String template = "/inc/mail_developerAndValidator.xhtml";
    String template = "/inc/mail_simple.xhtml";
    
    List&lt;StatisticsForUser&gt; statistics = getStatisticsToMail&#40;&#41;;
    for&#40;int i = 0; i &lt; statistics.size&#40;&#41;; i++&#41; {
      HashMap&lt;String, Object&gt; contextMap = new HashMap&lt;String, Object&gt;&#40;&#41;;
      contextMap.put&#40;"user", user&#41;; 
      contextMap.put&#40;"statisticForUser", statistics.get&#40;i&#41;&#41;;

      asynchronousMailProcessor.scheduleEmailSend&#40;2000 + i*500, template, contextMap&#41;; 
    }
  }</pre>
		</div>

I don't see any differrences to your version, so I don't have any idea why I can't use h:outputText. If you need more code (I reduced it to the - in my eyes - relevant part) just tell me.

Thanks in advance
Newlukai]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37175</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37175</link>
				<pubDate><![CDATA[Tue, 1 Jul 2008 06:47:21]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I just had a debug session. Using ICEfaces, the renderers for <h:> tags are replaced by renderers provided by ICEfaces. Those renderers make use of DOMResponseWriter which expects a BridgeFacesContext as parameter. This parameter is somewhere in the call stack taken from FacesContext.getCurrentInstance(). But since the UIMessage calls MailFacesContextImpl.start() which replaces FacesContext's instance by itself and makes your MockBridgeFacesContext to a member, the cast to (BridgeFacesContext) can't be done in DOMResponseWriter.

I see only two possibilities: don't use h tags when using icefaces.jar, or use just-ice.jar. Since I have to change too much if I want to use just-ice.jar, I prefer the first possibility. Do you have another idea?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37181</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37181</link>
				<pubDate><![CDATA[Tue, 1 Jul 2008 10:00:27]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ When you use just-ice.jar, the whole point is not to use the ICEfaces renderers with the h tags and to this delegate to the jsf renderers.  In this way you can distinguish between the 2 handlers.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37422</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37422</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 08:39:53]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Sorry, I don't know if I got it right. Could you please explain it a little more detailed?

Is there any drawback using just-ice.jar?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37423</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37423</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 08:42:19]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Check the sample application attached to http://jira.icefaces.org/browse/ICE-2321

]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37427</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37427</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 08:46:46]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ But to run this I need Seam 2.1.0?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37432</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37432</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 08:59:15]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Yeah....Pete did some work with 2.1.0 for this to work, but you might want to try with the latest 2.0.3 release (CR1??) as he may have put it in both.  Originally the portal support was only in 2.1.0, but it also made it to the 2.0.2 release.   I don't have time right now to try it myself, but it might be worth a shot.  Let me know.

Otherwise, you have to use gstacey's fix.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37437</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37437</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 09:35:54]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ ATM I'm testing my app with just-ice.jar and it seems that most of it still works. Some few features don't work anymore ...
Anyway, I used gstaceys fix which works as expected but I had to transfer the "h:outputText render=" stuff to the bean. It now decides which one out of three templates has to be sent. It would be perfect if it worked as it should. Sometimes the mail isn't sent without any information and sometimes I get an exception on the frontend after a mail was sent. I don't know why ...]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37439</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37439</link>
				<pubDate><![CDATA[Mon, 7 Jul 2008 09:42:37]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ <p></p>

		<cite>Newlukai wrote:</cite><br>
		<blockquote>I just had a debug session. Using ICEfaces, the renderers for <h:> tags are replaced by renderers provided by ICEfaces. Those renderers make use of DOMResponseWriter which expects a BridgeFacesContext as parameter. This parameter is somewhere in the call stack taken from FacesContext.getCurrentInstance(). But since the UIMessage calls MailFacesContextImpl.start() which replaces FacesContext's instance by itself and makes your MockBridgeFacesContext to a member, the cast to (BridgeFacesContext) can't be done in DOMResponseWriter.

&nbsp;
		</blockquote>

I'm puzzled why you get this error.  The issue you describe is exactly what this workaround is working around.  Are you sure that the you have the latest code?  have you debugged into the workaround code?  In the context.wrap at the start of the emailSend method it sets the responseWriter to an HtmlResponseWriter.  If you step through it with the debugger, is this happening?  It can't be or you would not see the error you describe...]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37695</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37695</link>
				<pubDate><![CDATA[Thu, 10 Jul 2008 15:14:13]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ I'm using the version of your code which can be found in JIRA. The only differences are the package statement and the catch clause in scheduleEmailSend.

Perhaps I've to use a newer Seam version? I'm using 2.0.1.

As far as I can see, your wrap and unwrap methods do what they should. The problem is that deeper in the lifecycle you context is wrapped by a Seam context which can't be cast to BridgeFacesContext. I don't know how your code could prevent this wrapping.

And I have another problem. From time to time it happens that scheduleMailSend finishes successfully, but the mail is never sent. Do you have any idea how this can happen? Probably it's this call is problematic:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>public void sendMails&#40;&#41; {
    List&lt;StatisticsForUser&gt; statistics = getStatisticsToMail&#40;&#41;;
    
    for&#40;int i = 0; i &lt; statistics.size&#40;&#41;; i++&#41; {
      StatisticsForUser sfu = statistics.get&#40;i&#41;;
      HashMap&lt;String, Object&gt; contextMap = new HashMap&lt;String, Object&gt;&#40;&#41;;
      contextMap.put&#40;"user", user&#41;; 
      contextMap.put&#40;"statisticForUser", sfu&#41;;
      contextMap.put&#40;"releaseDescr", selectedRelease.getDescr&#40;&#41;&#41;;
      
      String template = "/inc/mail_developerAndValidator.xhtml";
      if&#40;sfu.isSendDeveloperMail&#40;&#41; && !sfu.isSendValidatorMail&#40;&#41;&#41; {
        template = "/inc/mail_developer.xhtml";
      } else if&#40;!sfu.isSendDeveloperMail&#40;&#41; && sfu.isSendValidatorMail&#40;&#41;&#41; {
        template = "/inc/mail_validator.xhtml";
      }

      try {
        asynchronousMailProcessor.scheduleEmailSend&#40;2000 + i*500, template, contextMap&#41;;
      } catch&#40;Exception e&#41; {
        FacesUtil.addMessage&#40;"", "error_stats_mailSend", "error_stats_mailSend_queuing",
          statistics.get&#40;i&#41;.getUser&#40;&#41;.getName&#40;&#41;&#41;;
      }
      
      FacesUtil.addMessage&#40;null, null, FacesMessage.SEVERITY_INFO, "info_stats_mailSend",
        "info_stats_mailSend_pending", statistics.get&#40;i&#41;.getUser&#40;&#41;.getName&#40;&#41;&#41;;
    }
  }</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37726</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37726</link>
				<pubDate><![CDATA[Fri, 11 Jul 2008 01:09:39]]> GMT</pubDate>
				<author><![CDATA[ Newlukai]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ The key thing in the wrap method is that it resets the responseWriter from a DOMResponseWriter, which would try to do the cast you are mentioning, to a basic HTMLResponseWriter which does not do this cast.

As for the email not sending, I would check whatever email logs you have available to see if it got sent.  Most such errors in my testing came from the email getting stuck in someones spam filter.  Perhaps look at using Meldware to handle the delivery.]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#37758</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#37758</link>
				<pubDate><![CDATA[Fri, 11 Jul 2008 10:29:55]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Can somebody help me with what I need to change in the
<a href='http://jira.icefaces.org/secure/attachment/11035/AsynchronousIceFacesMailProcessor.java' target='_new' rel="nofollow">http://jira.icefaces.org/secure/attachment/11035/AsynchronousIceFacesMailProcessor.java</a>
in order to get it to work with Seam 2.0.2.SP1?

Maybe somebody who has already got a working solution could just post the file.

thanks
]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38293</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38293</link>
				<pubDate><![CDATA[Tue, 22 Jul 2008 15:15:28]]> GMT</pubDate>
				<author><![CDATA[ dammi]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ It's working fine in 2.0.2SP1 for me, as posted.  What error are you getting?]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38301</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38301</link>
				<pubDate><![CDATA[Tue, 22 Jul 2008 16:02:56]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ The imports

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
import org.jboss.seam.ui.util.JSF;
import com.sun.faces.RIConstants;
import com.sun.faces.application.ViewHandlerImpl;
import com.sun.faces.renderkit.html_basic.HtmlResponseWriter;
</pre>
		</div>

cannot be resolved.

There is a org.jboss.seam.util.JSF instead of the org.jboss.seam.ui.util.JSF, but this class hasn't got the method renderChildren which is used in line 112

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
JSF.renderChildren&#40;facesContext, root&#41;;
</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38305</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38305</link>
				<pubDate><![CDATA[Tue, 22 Jul 2008 16:19:36]]> GMT</pubDate>
				<author><![CDATA[ dammi]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ Ah.  I'd forgotten about that.  The posted version has the imports for Seam 2.0.0.  You need to change the import for 2.0.2 from

import org.jboss.seam.util.JSF;
to
import org.jboss.seam.ui.util.JSF;

]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38310</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38310</link>
				<pubDate><![CDATA[Tue, 22 Jul 2008 17:07:15]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ The method renderChildren(FacesContext, UIViewRoot) is undefined for the type org.jboss.seam.util.JSF in version 2.0.2

HtmlResponseWriter cannot be resolved
RIConstants cannot be resolved	
ViewHandlerImpl cannot be resolved]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38337</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38337</link>
				<pubDate><![CDATA[Wed, 23 Jul 2008 00:38:16]]> GMT</pubDate>
				<author><![CDATA[ dammi]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ I just double-checked the Seam source and there is indeed a import org.jboss.seam.ui.util.JSF and it contains the method stated.  It is in the jboss-seam-ui.jar rather than the main jboss-seam.jar.

For the other refrences you need to add the following jar to your classpath:
jsf-impl.jar

It is in the Seam lib directory.
]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38365</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38365</link>
				<pubDate><![CDATA[Wed, 23 Jul 2008 10:10:16]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ You are correct:) 

I only looked in the normal seam api, and I didn't see that there was a separate doc for the org.jboss.seam.ui.

Thanks]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#38383</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#38383</link>
				<pubDate><![CDATA[Wed, 23 Jul 2008 12:17:59]]> GMT</pubDate>
				<author><![CDATA[ dammi]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Another problem:

When sending mail context.wrap() in the scheduleEmailSend method causes an error. Running in the debugger I can see that an InvocationTargetException is thrown
in line 175 in AsynchronousIceFacesMailProcessor.java. 

This is the line
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
facesContext.setResponseWriter&#40;new HtmlResponseWriter&#40;writer, "text/html", RIConstants.CHAR_ENCODING, false&#41;&#41;;
</pre>
		</div>

And the exception is wrapping 
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
java.lang.NoSuchMethodError: com.sun.faces.renderkit.html_basic.HtmlResponseWriter.&lt;init&gt;&#40;Ljava/io/Writer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;&#41;V
</pre>
		</div>

Any clues?

]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#39524</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#39524</link>
				<pubDate><![CDATA[Fri, 15 Aug 2008 07:26:37]]> GMT</pubDate>
				<author><![CDATA[ dammi]]></author>
			</item>
			<item>
				<title>Re:A fix for Seam mail</title>
				<description><![CDATA[ Did you try delegation (similar to the example that is attached to <a href="http://jira.icefaces.org/browse/ICE-2321" target="_new" rel="nofollow">the jira</a> ?

A lot of the seam framework changes that have been done for 2.1.0 have been incorporated into 2.0.2, so it might be worth a try (instead of trying to unwrap and rewrap the contexts as you have to do for 2.0.0 and 2.0.1)
]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#39525</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#39525</link>
				<pubDate><![CDATA[Fri, 15 Aug 2008 08:36:41]]> GMT</pubDate>
				<author><![CDATA[ judy.guglielmin]]></author>
			</item>
			<item>
				<title>A fix for Seam mail</title>
				<description><![CDATA[ The constructor for HtmlResponseWriter changed in... I forget which version.  Obviously, the one you are running.  You just need to drop the final argument off the constructor call.

i.e. facesContext.setResponseWriter(new HtmlResponseWriter(writer, "text/html",				RIConstants.CHAR_ENCODING));]]></description>
				<guid isPermaLink="true">http://www.icefaces.org/JForum/posts/list/8058.page#39535</guid>
				<link>http://www.icefaces.org/JForum/posts/list/8058.page#39535</link>
				<pubDate><![CDATA[Fri, 15 Aug 2008 12:10:30]]> GMT</pubDate>
				<author><![CDATA[ gstacey]]></author>
			</item>
	</channel>
</rss>