Hi,
We ran into the following issue after upgrading from XWiki version 12.6.3 to 12.7 (but also anything after that). We are using an external solr, and have identified that when switching to an embedded solr, we do not have the issue. This error shows up on every single page where the like button is supposed to be.
Any help/insights would be appreciated.
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [{{html wiki="true"}}
#if ($services.like.displayButton($doc))
## We want to be sure that the async rendering framework invalidate cache if the document is modified.
#set ($discard = $services.async.useEntity($doc))
#set ($optLikeCount = $services.like.getLikes($doc))
#if ($optLikeCount.isPresent())
#set ($likeCount = $optLikeCount.get())
#set ($discard = $xwiki.ssx.use('XWiki.Like.LikeUIX'))
#set ($discard = $xwiki.jsx.use('XWiki.Like.LikeUIX'))
<div class="like-container">
<input id="is-liked" type="hidden" value="$services.like.isLiked($doc)" />
#if ($isGuest || $services.like.isLiked($doc))
#set ($btnClass = "btn-default")
#set ($titleMessageTranslationKey = "like.button.title.unlike")
#elseif (!$isGuest)
#set ($btnClass = "btn-primary")
#set ($titleMessageTranslationKey = "like.button.title.like")
#end
#set ($disabledButton = "")
#if (!$services.like.isAuthorized($doc))
#set ($disabledButton = "disabled")
#set ($titleMessageTranslationKey = "like.button.title")
#end
<div class="like-button btn $btnClass $disabledButton badge" title="$escapetool.xml($services.localization.render($titleMessageTranslationKey, [$likeCount]))">
$services.icon.renderHTML('heart') <span class="like-number">$likeCount</span>
</div>
</div>
#end
#end
{{/html}}]
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:139)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:52)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:297)
at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:101)
at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.transform(AbstractBlockAsyncRenderer.java:74)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRenderer.tranform(DefaultBlockAsyncRenderer.java:143)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRenderer.execute(DefaultBlockAsyncRenderer.java:126)
at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
at org.xwiki.uiextension.internal.WikiUIExtension.render(WikiUIExtension.java:179)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor$DecoratorWrapper.render(DefaultBlockAsyncRendererExecutor.java:67)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor$DecoratorWrapper.render(DefaultBlockAsyncRendererExecutor.java:49)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:232)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:113)
at org.xwiki.uiextension.internal.AbstractWikiUIExtension.execute(AbstractWikiUIExtension.java:112)
at jdk.internal.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:565)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:548)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:219)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:369)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:701)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:72)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:165)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:369)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:490)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:306)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:276)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:301)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:172)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:172)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:191)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423)
at org.apache.velocity.Template.merge(Template.java:358)
at org.apache.velocity.Template.merge(Template.java:262)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:284)
at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:316)
at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:217)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:180)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:137)
at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:53)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:772)
at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:745)
at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:725)
at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:711)
at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:78)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2516)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:179)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:572)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:250)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:109)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1626)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with namespace [xwiki:XWiki.Like.LikeUIX^XWiki.UIExtensionClass[0]]
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:292)
at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:316)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131)
... 112 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLikes' in class org.xwiki.like.script.LikeScriptService threw exception java.lang.NullPointerException at xwiki:XWiki.Like.LikeUIX^XWiki.UIExtensionClass[0][line 5, column 38]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:306)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:233)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:369)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:701)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:72)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:240)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:172)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423)
at org.apache.velocity.Template.merge(Template.java:358)
at org.apache.velocity.Template.merge(Template.java:262)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:284)
... 114 more
Caused by: java.lang.NullPointerException
at org.xwiki.ratings.internal.SolrRatingsManager.countRatings(SolrRatingsManager.java:382)
at org.xwiki.like.internal.DefaultLikeManager.getEntityLikes(DefaultLikeManager.java:273)
at org.xwiki.like.script.LikeScriptService.getLikes(LikeScriptService.java:190)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:565)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:548)
at org.xwiki.velocity.introspection.MethodArgumentsUberspector$ConvertingVelMethod.invoke(MethodArgumentsUberspector.java:201)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:219)
... 124 more