AnsweredAssumed Answered

No top level scope?

Question asked by cs02rm0 on Mar 22, 2013
Latest reply on Oct 14, 2015 by electroshokker

I'm reworking a Javascript webscript into a Java one. The Java one now extends DeclarativeWebscript and returns a Map of Lists of Maps, etc. down to a ScriptNode.

item.put("node", new ScriptNode(nodeRef, _serviceRegistry));

The freemarker which takes the model from the Java is erroring:

Caused by: freemarker.template.TemplateModelException: get(properties) failed on instance of org.alfresco.repo.jscript.ScriptNode

Caused by: java.lang.reflect.InvocationTargetException

Caused by: java.lang.NullPointerException
   at org.mozilla.javascript.ScriptableObject.getTopLevelScope(
   at org.mozilla.javascript.ScriptRuntime.setObjectProtoAndParent(
   at org.mozilla.javascript.Context.newArray(
   at org.alfresco.repo.jscript.ValueConverter.convertValueForScript(
   at org.alfresco.repo.jscript.ScriptNode$NodeValueConverter.convertValueForScript(
   at org.alfresco.repo.jscript.ScriptNode$NodeValueConverter.convertValueForScript(
   at org.alfresco.repo.jscript.ScriptNode.getProperties(
   … 116 more

Any suggestions on why there isn't a top level scope / how I can get one? Thanks.