AnsweredAssumed Answered

java.lang.IllegalArgumentException: FacesContext must not be

Question asked by andrepra on Oct 8, 2010
Latest reply on Oct 26, 2010 by kevinr
Hi,
I have a problem configuring a custom action configured on a Share event (Alfresco 3.3g). I would create a notification on creation of a new post in the Share site discussion. I developed the custom action and i configured it on the event "create" on the root folder "Sites". Trying the action with Alfresco web client works fine. 
When I create a post in a Share site correctly fires the action, but when I try to get the information from the RepositoryService about the new node I get an exception

java.lang.IllegalArgumentException: FacesContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(FacesContextUtils.java:50)
at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:81)
at org.alfresco.web.bean.repository.Repository.getServiceRegistry(Repository.java:584)
at org.alfresco.web.bean.repository.Node.getServiceRegistry(Node.java:514)
at org.alfresco.web.bean.repository.Node.getType(Node.java:306)
at it.quix.share.todolist.action.executer.ToDoListNotificationAction.getDashletActive(ToDoListNotificationAction.java:232)
at it.quix.share.todolist.action.executer.ToDoListNotificationAction.access$100(ToDoListNotificationAction.java:28)
at it.quix.share.todolist.action.executer.ToDoListNotificationAction$1.doWork(ToDoListNotificationAction.java:72)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at it.quix.share.todolist.action.executer.ToDoListNotificationAction.executeImpl(ToDoListNotificationAction.java:110)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:133)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:726)
at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:133)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:726)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:658)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:494)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:321)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:228)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:503)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:506)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

Performing a simple login to the Alfresco web client e repeating the post submition in Share everything works fine.
It seems that the FacesContext is initialized only at the first login. I found a similar post here

http://forums.alfresco.com/en/viewtopic.php?f=4&t=26224

but there's no response.
Thanks

Outcomes