AnsweredAssumed Answered

NullPointerException in SpringBeanFactoryProxyMap.containsKey

Question asked by sergey.p on Aug 25, 2015
Latest reply on Sep 4, 2015 by sergey.p
Hello,

I'm experiencing a NPE when adding script task to a process in a Spring web application.
The process itself is pretty complicated, but runs w/o any issues except for this.

Here's the stacktrace:


25 Aug 2015 17:43:48 DEBUG org.activiti.engine.impl.interceptor.CommandContext  - Error while closing command context
java.lang.NullPointerException
   at org.activiti.engine.impl.cfg.SpringBeanFactoryProxyMap.containsKey(SpringBeanFactoryProxyMap.java:46)
   at org.activiti.engine.impl.scripting.BeansResolverFactory.containsKey(BeansResolverFactory.java:30)
   at org.activiti.engine.impl.scripting.ScriptBindings.get(ScriptBindings.java:71)
   at javax.script.SimpleScriptContext.getAttribute(SimpleScriptContext.java:167)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:107)
   at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:87)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:73)
   at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:62)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)


Here's where it fails:


  public boolean containsKey(Object key) {
    if ( (key==null) || (!String.class.isAssignableFrom(key.getClass())) ) {
      return false;
    }
    return beanFactory.containsBean((String) key);
  }


Apparently, beanFactory is null.

Here's the excerpt from process configuration:


    …
    <startEvent id="sid-D8FCB27D-46BC-4401-9F0C-147F4103AFB8" activiti:initiator="initiator"></startEvent>
    <sequenceFlow id="sid-E963054E-9A90-4F05-8F6E-27D44150B2FA" sourceRef="sid-D8FCB27D-46BC-4401-9F0C-147F4103AFB8" targetRef="testScript"></sequenceFlow>
    <scriptTask id="testScript" name="TestScript" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script><![CDATA[out:print "Testing script task\n";
testVar = "test";]]></script>
    </scriptTask>
    <sequenceFlow id="sid-7D68D05F-1CF7-4000-8E67-FE5526B6DD21" sourceRef="testScript" targetRef="fillVariables"></sequenceFlow>
    …


The same pocess definition runs normally if I import it into activiti-explorer.

The problem is that I have no idea how to start debugging this, — can someone please give me a couple pointers on where to start?
I have a couple of task listeners configured through parse handlers, — might that be the issue?

Outcomes