AnsweredAssumed Answered

Advanced search problem (exception)

Question asked by matjazmuhic on Feb 29, 2012
Latest reply on Mar 6, 2012 by matjazmuhic
I customized advanced search like this:


<config replace="false" evaluator="string-compare" condition="AdvancedSearch">
  <advanced-search>
   <forms>
    <form labelId="rev.search.label" descriptionId="rev.search.description">ag:rev</form>
   </forms>
  </advanced-search>
</config>

I also defined search form for the type:


<config evaluator="node-type" condition="ag:rev">
  <forms>
   <form>
      … default form is the same as search form …
   </form>
   <form id="search">
    <field-visibility>
     <show id="ag:revNum"/>
     <show id="ag:lmqSerial"/>
     <show id="ag:prevLmqSerial"/>
     <show id="ag:oe"/>
     <show id="ag:sm"/>
     <show id="ag:location"/>
     <show id="ag:locCode"/>
     <show id="ag:room"/>
     <show id="ag:invNum"/>
     <show id="ag:revDate"/>
     <show id="ag:installed"/>
     <show id="ag:sent"/>
    </field-visibility>
    <appearance>
     <set id="reverse" appearance="bordered-panel" label-id="rev.set"/>
     <field id="ag:revNum" label-id="rev.revNum" set="reverse"/>
     <field id="ag:lmqSerial" label-id="rev.lmqSerial" set="reverse"/>
     <field id="ag:prevLmqSerial" label-id="rev.prevLmqSerial" set="reverse"/>
     <field id="ag:oe" label-id="rev.oe" set="reverse"/>
     <field id="ag:sm" label-id="rev.sm" set="reverse"/>
     <field id="ag:location" label-id="rev.location" set="reverse"/>
     <field id="ag:locCode" label-id="rev.locCode" set="reverse"/>
     <field id="ag:room" label-id="rev.room" set="reverse"/>
     <field id="ag:invNum" label-id="rev.invNum" set="reverse"/>
     <field id="ag:revDate" label-id="rev.revDate" set="reverse"/>
     <field id="ag:installed" label-id="rev.installed" set="reverse"/>
     <field id="ag:sent" label-id="rev.sent" set="reverse"/>
    </appearance>
   </form>
  </forms>
</config>

Then when I go to advanced search and search on some property I get this in logs:


13:31:26,962 User:admin ERROR [freemarker.runtime] Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.

Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.
The problematic instruction:
———-
==> ${item.site.shortName} escaped ${jsonUtils.encodeJSONString(item.site.shortName)} [on line 23, column 47 in org/alfresco/slingshot/search/search.get.json.ftl]
———-

Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.Expression.getStringValue(Expression.java:118)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:417)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.Environment.process(Environment.java:190)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:197)
   at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:589)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:377)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:619)
13:31:26,964  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 01290006 Wrapped Exception (with status template): 01290018 Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.'. Please contact your system administrator.
org.springframework.extensions.webscripts.WebScriptException: 01290006 Wrapped Exception (with status template): 01290018 Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.'. Please contact your system administrator.
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:758)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:377)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.service.cmr.repository.TemplateException: 01290018 Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.'. Please contact your system administrator.
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)
   at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:589)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
   … 24 more
Caused by: freemarker.core.InvalidReferenceException: Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 15 in org/alfresco/slingshot/search/search.get.json.ftl.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.Expression.getStringValue(Expression.java:118)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:417)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:210)
   at freemarker.core.Environment.process(Environment.java:190)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:197)
   … 27 more

Outcomes