Error Executing Custom Operation

Hi there,

I have followed the example for coding your first operation here: http://doc.nuxeo.com/display/public/NXDOC/Coding+your+first+operation

I have deployed the operation successfully to Studio and created an automation chain with the following steps:

Fetch -> Context Document(s)

Services -> RandomStringGenerator (my sample operation)

 Set the name value as MyRandomString

Document -> Update Properties

 Set the properties value as uid:uid=@{idValue} newsarticle:articleSummary=@{MyRandomString} and checked the save button

I then set up a user action to trigger this automation chain on the Document Edition Form, enabled for my NewsArticle type and deployed this to my platform instance.

However, when I click this button from the edit form, I get the following error:

Context

Request Attributes:

com.sun.faces.util.RequestStateManager : {com.sun.faces.renderKitImplForRequest=org.ajax4jsf.renderkit.ChameleonRenderKitFactory@7eb8810d, com.sun.faces.ComponentForValue=org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder@77e800ab, com.sun.faces.INVOCATION_PATH=.faces, com.sun.faces.ExternalContextImpl=com.sun.faces.context.ExternalContextImpl@2084180d}
nuxeo.disable.redirect.wrapper : true
org.jboss.seam.core.conversationPropagation : org.jboss.seam.core.ConversationPropagation@40470e28
org.richfaces.component.DecodesPhaseNotifiyingListener:_AFTER_DECODE_PHASE : true
actionManager : org.nuxeo.ecm.platform.actions.ActionService@78f2850f
messageBundle : java.util.PropertyResourceBundle@79fdd9d1
org.jboss.seam.core.manager : Manager([0NXMAIN2])
operationActionBean : org.nuxeo.ecm.automation.jsf.OperationActionBean@8e766e9
org.ajax4jsf.application.AjaxStateManager.AJAX_VIEW_SEQUENCE : j_id51
stackTrace : javax.servlet.ServletException: On requestURL: http://localhost:8080/nuxeo/view_documents.faces
    at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.webdav.service.WIRequestFilter.doFilter(WIRequestFilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoRequestControllerFilter.doFilter(NuxeoRequestControllerFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:614)
    at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:35)
    at org.nuxeo.ecm.platform.ui.web.auth.oauth2.NuxeoOAuth2Filter.doFilter(NuxeoOAuth2Filter.java:68)
    at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:33)
    at org.nuxeo.ecm.platform.ui.web.auth.oauth.NuxeoOAuthFilter.doFilter(NuxeoOAuthFilter.java:119)
    at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:33)
    at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilter(NuxeoAuthenticationFilter.java:410)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoCorsFilter.doFilter(NuxeoCorsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.web.common.exceptionhandling.NuxeoExceptionFilter.doFilter(NuxeoExceptionFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.web.common.encoding.NuxeoEncodingFilter.doFilter(NuxeoEncodingFilter.java:69)
    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:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.servlet.ServletException: #{action.getLink()}: javax.el.ELException: java.lang.NullPointerException
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.wss.servlet.BaseWSSFilter.doFilter(BaseWSSFilter.java:137)
    at org.nuxeo.wss.servlet.FailSafeWSSFilter.doFilter(FailSafeWSSFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
    at org.nuxeo.ecm.platform.ui.web.multipart.MultipartFilter.doFilter(MultipartFilter.java:70)
    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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
    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.nuxeo.ecm.core.management.jtajca.internal.Log4jWebFilter.doFilter(Log4jWebFilter.java:64)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:129)
    ... 39 more
Caused by: javax.faces.FacesException: #{action.getLink()}: javax.el.ELException: java.lang.NullPointerException
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at javax.faces.component.UICommand.broadcast(UICommand.java:387)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder.broadcast(UIValueHolder.java:83)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder.broadcast(UIValueHolder.java:83)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
    at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at org.nuxeo.ecm.platform.ui.web.lifecycle.NuxeoLifeCycleImpl.execute(NuxeoLifeCycleImpl.java:83)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    ... 65 more
Caused by: javax.faces.el.EvaluationException: javax.el.ELException: java.lang.NullPointerException
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    ... 94 more
Caused by: javax.el.ELException: java.lang.NullPointerException
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
    at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
    at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    at org.nuxeo.ecm.platform.ui.web.binding.MetaMethodExpression.invoke(MetaMethodExpression.java:124)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    ... 95 more
Caused by: java.lang.NullPointerException
    at org.nuxeo.ecm.automation.core.trace.BasedTracer.getFormattedText(BasedTracer.java:114)
    at org.nuxeo.ecm.automation.TraceException.<init>(TraceException.java:32)
    at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:195)
    at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:89)
    at org.nuxeo.ecm.automation.jsf.OperationActionBean.runOperation(OperationActionBean.java:88)
    at org.nuxeo.ecm.automation.jsf.OperationActionBean.doOperation(OperationActionBean.java:62)
    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:22)
    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:28)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:68)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
    at org.nuxeo.ecm.platform.ui.web.util.NuxeoExceptionInterceptor.aroundInvoke(NuxeoExceptionInterceptor.java:79)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
    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 org.nuxeo.ecm.automation.jsf.OperationActionBean_$$_javassist_80.doOperation(OperationActionBean_$$_javassist_80.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)
    ... 102 more

currentServerLocation : org.nuxeo.ecm.platform.util.RepositoryLocation@5c13d641
user_message : An unexpected error occurred. Click on the following links to get more information or go back to the application.
NuxeoExceptionHandlerMarker : true
currentDocument : DocumentModelImpl(b3f7e4d2-f0e2-4ba8-ba1f-71970741be99, path=/default-domain/Specifications-news-API, title=Specifications-news-API)
org.jboss.seam.transaction.transaction : org.jboss.seam.transaction.Transaction@10154f90
securityError : false
org.jboss.seam.transaction.synchronizations : org.jboss.seam.transaction.SeSynchronizations@671a7f2f
org.jboss.seam.faces.validation : org.jboss.seam.faces.Validation@7c941b8a
org.jboss.seam.web.requestContextPath : /nuxeo
org.jboss.seam.web.servletContexts : org.jboss.seam.web.ServletContexts@5f9c40eb
org.jboss.seam.core.events : org.jboss.seam.core.Events@b6a3557
org.jboss.seam.web.requestServletPath : /view_documents.faces
org.nuxeo.ecm.platform.ui.web.binding.alias.AliasVariableMapper_MARKER : {}

Please can you advise what may be going wrong?

Thanks, Lynn

0 votes

2 answers

2246 views

ANSWER

Hi,

To debug automation chains execution, don't hesitate in your [nuxeo]/bin/nuxeo.conf to uncomment this property: org.nuxeo.automation.trace=true. It will deliver more logs to understand what is wrong in your automation chain. Have you correctly declare your variables like e.g. @{MyRandomString}.

But I don't see in the logs you have send any of automation…

if you don't have any failure in your operation chains, you should see on the "action" side. How did you proceed to create this button?

05/05/2014

Hi Vladimir,

Thanks for your response.

I turned on the automation logging as you described and restarted my server but the entry in the nuxeo-error.log is just the same as above.

My variable MyRandomString should be declared in the custom operation extension in the line: context.put(name, randomString); As MyRandomString is set as the name in the operation chain.

I created the action button in Studio under User Actions. A button is displayed on the Document Edition Form for one of my custom Content Types (NewsArticle)

Could the problem be in the action? Caused by: javax.faces.FacesException: #{action.getLink()}: javax.el.ELException: java.lang.NullPointerException

at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)

Thanks, Lynn

05/05/2014



The problem was related to the fact that the id of the automation chain was the same as the id of the operaiton called in the automation chain: RandomStringGenerator. Internally, Nuxeo handles an Automation Chain the same way it handles a single operation. So, when the chain called the operation, nuxeo actually called the chain again, leading to the error. Renaming the automation chain solved the issue.

2 votes



Thank you for the troubleshooting and the trick: it saved my night!

0 votes