cancel
Showing results for 
Search instead for 
Did you mean: 

Site Searching in Share broke

tbuehrer
Champ in-the-making
Champ in-the-making
Something happened today and now whenever we try to do a site search we get the following error message:

Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 23 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.

I'm the administrator and can't figure out what went wrong.  One possibility is that a user in share added a site and then deleted it, but other than that, we were not doing much with our server that could have made it blow up.

Any helpful hints would be greatfully appreciated.  (I have rebooted, tried adding a site and dropping a site)

Tim
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
You get these sort of errors when either the freemarker template is corrupt or the object (in this case site) has a missing attribute.

Is it possible that the file "site.lib.ftl" has been modified?

If not then there may be a little more information in the Alfresco.log file that will help with diagnosing this problem.

tbuehrer
Champ in-the-making
Champ in-the-making
Thanks for the suggestion.  I did not modify any of the files.  The extract from the log is:

Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 23 in org/alfresco/repository/site/site.lib.ftl.
The problematic instruction:
———-
==> ${site.sitePreset} escaped ${jsonUtils.encodeJSONString(site.sitePreset)} [on line 5, column 41 in org/alfresco/repository/site/site.lib.ftl]
in user-directive siteLib.siteJSON [on line 5, column 17 in org/alfresco/repository/site/sites.get.json.ftl]
———-

Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 23 in org/alfresco/repository/site/site.lib.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:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.Macro$Context.runMacro(Macro.java:164)
   at freemarker.core.Environment.visit(Environment.java:601)
   at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:415)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.Environment.process(Environment.java:188)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:201)
   at org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:377)
   at org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:280)
   at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:173)
   at org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:309)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:294)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:209)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:320)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:264)
   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:240)
   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
   at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter.doFilter(MTWebScriptAuthenticationFilter.java:102)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
   at java.lang.Thread.run(Thread.java:619)

I presume that there is a faulty attribute, but which one and how does one fix it?

Thanks.

Tim

smac
Champ in-the-making
Champ in-the-making
I've run into the same problem and discovered the following:

I created a new site under the alfresco interface (http://localhost:8080/alfresco) then logged into the alfresco share interface (http://localhost:8080/share), and tried to add the newly created site to my dashboard by searching for it. Doing this threw up the same error as above.

When I logged back into the alfresco interface and removed the newly created site, then went back to the share interface and performed another search - the search function worked properly.

It seems that if I create new sites under the share interface, I'm able to search for them without issues, but as soon as I create one under the alfresco interface, it spits out the same error every time.

mikeh
Star Contributor
Star Contributor
Creating sites form the Alfresco Explorer (/alfresco) interface isn't supported, because - as you have discovered - they will be missing vital attributes.

There's a warning when entering the "sites" space that the area should only be accessed using the Share interface - although you may have a very early build that didn't have this warning.

Mike