Problems using Seam Mail from a process
chawax Mar 27, 2008 2:34 PMHi,
I created a Seam component that has a method using Seam Mail to send mails.
public void mailDemandeAcceptee() throws java.lang.Exception { VOEmploye demandeur = getServiceBaseEmploye().loadEmploye(this.demandeAbsence.getMatriculeDemandeur()); Context context = Contexts.getEventContext(); context.set("demandeur", demandeur); context.set("demandeAbsence", this.demandeAbsence); renderer.render("/mails/demandeAbsenceAcceptee.xhtml"); }
This method is called on a transition in a JPBM process.
<node name="acceptation"> <transition to="end"> <action expression="#{processusDemandeAbsenceAction.mailDemandeAcceptee()}" /> </transition> <action expression="#{processInstanceHandler.callELMethods('EL_ACTION_OK')}" /> </node>
I want these transition to be fired from either a facelet or a web service, so I created a Seam component to fire this transition with the following method :
public void followTransition(Long taskId, String transitionName) throws Exception { BusinessProcess businessProcess = BusinessProcess.instance(); if (businessProcess != null) { if (businessProcess.resumeTask(taskId)) { if (businessProcess.validateTask()) { businessProcess.startTask(); businessProcess.endTask(transitionName); } } } }
Everything works perfect when I call this method from a facelet (on a <s:button> for example).
But when I call it as a web service, I have the following error on calling the renderer.render() method:
Caused by: 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 org.jboss.seam.mock.MockFacesContext.<init>(MockFacesContext.java:60) at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.init(FaceletsRenderer.java:95) at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.run(FaceletsRenderer.java:77) at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:169)
Is it a bug ? Or is there something special to do to use Seam mail in this context ?
Thanks in advance for your help,
Olivier