[jboss-user] [JBoss Seam] - Re: Seam Email - IllegalStateException: No Factories configu

bsmithjj do-not-reply at jboss.com
Fri Feb 23 09:22:12 EST 2007


sample Render calls...

This method is in a SFSB - user clicks a link in UI:  (this one works!)

  |     public String dsaProvision() {
  |  
  |         TaskInstance task = jbpmContext.getTaskInstance(taskId.longValue());
  | 
  |         // Update the decision
  |         Contexts.getEventContext().set("accessRequest", accessRequest);
  |         String result = accessRequestProvisioner.applyAccessRequestToUser();
  |         if (!"success".equals(result)) {
  |             log.warn("There was a problem provisioning the user from the access request.");
  |             return null;
  |         }
  | 
  |         EvergreenUser accessRequestUser = QueryEPeopleUtil.findUserByUid(accessRequest.getUserId());
  |         Contexts.getEventContext().set(
  |             "accessRequestUser",
  |             accessRequestUser
  |         );
  | 
  |         // Send an email to the user and requester of the access request to let them know the request is done
  | 
  |         if (TerminationRequestManager.TerminationId.equals(accessRequest.getRequesterUserId())) {
  |             // termination request - only notify UserManager...
  |             // TODO - implement this
  |         } else {
  |             if (!accessRequest.getRequesterUserId().equals(accessRequest.getUserId())) {
  |                 Contexts.getEventContext().set(
  |                     "accessRequestRequestor",
  |                     QueryEPeopleUtil.findUserByUid(accessRequest.getRequesterUserId())
  |                 );
  |                 //mailSenderBean.sendEmailMessage(EmailTemplateType.AccessRequestCompleteRequestor.getTemplateFilePath());
  |             }
  |             // always notify user for whom request has been provisioned
  |             mailSenderBean.sendEmailMessage(EmailTemplateType.AccessRequestCompleteUser.getTemplateFilePath());
  |         }
  | 
  |         // Signal the task to move to next process in the work flow
  |         task.end("provision application");
  | 
  |         // Force a reload of the work queue
  | EventType.AccessRequestSaved.name());        Events.instance().raiseEvent(EventType.AccessRequestSaved.name());
  |         return "success";
  |     }
  | 
  | 

MailSenderBean is a SLSB 


  | @Stateless
  | @Name("mailSenderBean")
  | public class MailSenderBean implements MailSender {
  | 
  |     private Log log = LogFactory.getLog(MailSenderBean.class);
  | 
  |     @In(required=false)
  |     private EmailMessage emailMessage;
  | 
  |     //@Resource(mappedName = "java:/Mail")
  |     @In(create = true)
  |     private Session mailSession;
  | 
  |     @PersistenceContext(unitName = "accessControlDatabase")
  |     private EntityManager em;
  | 
  |     @In(create = true)
  |     private Renderer renderer;
  | 
  |     ....
  | 
  |         public String sendEmailMessage(String templateFile) {
  |         try {
  |             log.info("sending email:  "+templateFile);
  |             renderer.render(templateFile);
  |             log.info("...mailt sent(?)");
  |             return "success";
  | 
  |         } catch (Exception e) {
  |             log.error(e,e);
  |         }
  |         return null;
  |     }
  | 
  | }
  | 

The SFSB call above is succeeding;  what's really confusing is that another method in the same SFSB (shown below) is failing using an almost identical execution path and context (user clicks a link in a UI, etc...)

This method is in a SFSB - user clicks a link in UI:  (this one fails!)


  |     public String userManagerApproveAccessRequest() {
  |         TaskInstance task = jbpmContext.getTaskInstance(taskId.longValue());
  |         //Long accessRequestId = (Long) task.getContextInstance().getVariable("accessRequestId");
  | 
  |         // Update the status to user manager approved        accessRequest.setRequestStatus(AccessRequestStatus.UserManagerApproved);
  | 
  |         // Update the decision
  |         AccessRequestDecision decision = accessRequest.getUserManagerDecision();
  |         decision.setDecision(AccessRequestStatus.UserManagerApproved);
  |         em.merge(decision);
  |         em.merge(accessRequest);
  | 
  |         // contextual email data
  |         Contexts.getEventContext().set(
  |             "accessRequest",
  |             accessRequest
  |         );
  |         Contexts.getEventContext().set(
  |             "accessRequestUser",
  |             QueryEPeopleUtil.findUserByUid(accessRequest.getUserId())
  |         );
  |         mailSender.sendEmailMessage(
  |             EmailTemplateType.AccessRequestCompleteUser.getTemplateFilePath()
  |         );
  |         //  NOTE - I'm using the same mail template for troubleshooting...
  |         // Signal the task to move to next process in the work flow
  |         task.end("approve");
  |         // This event forces a reload of the work queue (in what component?)
  | Events.instance().raiseEvent(EventType.AccessRequestSaved.name());
  |         return "approve_success";
  | 
  |     }
  | 
  | 

if you go back in to my previous posts on this issue - you'll see, I've dumped what facelets is saying in the console log.  The point of success or failure in all cases is facelets and its ability to load jars with taglibs in it.  I really can't understand why the first case succeeds and the second doesn't.

Thanks for your help!

Brad Smith

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021115#4021115

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021115



More information about the jboss-user mailing list