Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-143391

Some Elements generate UnresolvedTemplateVariableExceptions

    Details

      Description

      Solution Notes

      For any OOTB element that requires parameters (in template variables or conditions):

      • Search Page - enter parameter values via Low Level Search Options widget.
      • Preview - enter parameter values via Preview Attributes dialog.

      If any parameter is still unresolved, search will complete with no user facing errors displayed, and server will log the UnresolvedTemplateVariableException as a warning.

      Example of a happy path with expected outcomes:

      1. Create a new log entry with WARN level for com.liferay.search.experiences.rest.internal.resource.v1_0.SearchResponseResourceImpl through the Server Admin
      2. Create a New blueprint.
      3. Preview.
        Expected: Search completes, results are displayed.
      4. Add element: "Boost Items for My Commerce Account Groups"
      5. Preview.
        Expected: Search completes, same results are displayed.
        Expected: Server side logs where nested WARN entries can be found.
        Invalid element instance at: 0
          Invalid query entry at: 0
            Unresolved template variables: [commerce.account_group_ids]
        

      Steps to reproduce
      Execute any of the following use cases for the OOTB elements below:

      • Boost Contents in a My Sites LPS-125768
      • Limit Search to My Contents Use Case
      • Boost Freshness LPS-125705
      • Boost Commerce Items for My Account Groups LPS-125812--
      • Scheduling Aware
      • Limit Search to the Current Site
      • Boost Proximity
      • Boost Contents in a Category for New User Accounts

      In addition to the steps in the above use cases, perform a search using the Blueprint preview sidebar if it is not already mentioned.

      Result: When searching via the Blueprint sidebar preview, UnresolvedTemplateVariableException is thrown. The variable causing the error will vary depending on the Element being used. Example:

      Suppressed: com.liferay.search.experiences.internal.blueprint.exception.UnresolvedTemplateVariableException: Unresolved template variables: [user.id]

      Full stacktrace:

      2021-12-10 23:42:25.755 ERROR [http-nio-8080-exec-3][ExceptionMapper:68] java.lang.RuntimeException: java.lang.RuntimeException
      	at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl._contributeSXPSearchRequestBodyContributors(SXPBlueprintSearchRequestEnhancerImpl.java:140)
      	at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl._enhance(SXPBlueprintSearchRequestEnhancerImpl.java:169)
      	at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl.lambda$_enhance$3(SXPBlueprintSearchRequestEnhancerImpl.java:227)
      	at com.liferay.portal.kernel.util.ArrayUtil.isNotEmptyForEach(ArrayUtil.java:1171)
      	at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl._enhance(SXPBlueprintSearchRequestEnhancerImpl.java:225)
      	at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl.enhance(SXPBlueprintSearchRequestEnhancerImpl.java:86)
      	at com.liferay.search.experiences.rest.internal.resource.v1_0.SearchResponseResourceImpl.lambda$postSearch$0(SearchResponseResourceImpl.java:92)
      	at com.liferay.portal.search.internal.legacy.searcher.SearchRequestBuilderImpl.lambda$withSearchRequestBuilder$43(SearchRequestBuilderImpl.java:538)
      	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
      	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
      	at com.liferay.portal.search.internal.legacy.searcher.SearchRequestBuilderImpl.withSearchRequestBuilder(SearchRequestBuilderImpl.java:537)
      	at com.liferay.search.experiences.rest.internal.resource.v1_0.SearchResponseResourceImpl.postSearch(SearchResponseResourceImpl.java:89)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201)
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
      	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
      	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
      	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
      	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
      	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
      	at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
      	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:50)
      	at com.liferay.portal.security.auth.verifier.internal.tracker.AuthVerifierFilterTracker$RemoteAccessFilter.doFilter(AuthVerifierFilterTracker.java:164)
      	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:121)
      	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:45)
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:147)
      	at com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter.processFilter(AuthVerifierFilter.java:212)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:121)
      	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:45)
      	at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:71)
      	at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:120)
      	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:372)
      	at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:70)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
      	at com.liferay.portal.module.framework.ModuleFrameworkServletAdapter.service(ModuleFrameworkServletAdapter.java:54)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
      	at com.liferay.shielded.container.internal.proxy.ServletWrapper.service(ServletWrapper.java:113)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:124)
      	at com.liferay.portal.remote.cors.internal.servlet.filter.PortalCORSServletFilter.processFilter(PortalCORSServletFilter.java:237)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.servlet.filters.password.modified.PasswordModifiedFilter.processFilter(PasswordModifiedFilter.java:62)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.servlet.filters.lockout.LockoutFilter.processFilter(LockoutFilter.java:58)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:147)
      	at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:147)
      	at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:245)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
      	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
      	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
      	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
      	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)
      	at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:65)
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:175)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:175)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:104)
      	at com.liferay.shielded.container.internal.proxy.FilterWrapper.doFilter(FilterWrapper.java:79)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
      	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
      	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      	Suppressed: java.lang.RuntimeException
      		at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor.contribute(QuerySXPSearchRequestBodyContributor.java:72)
      		at com.liferay.search.experiences.internal.blueprint.search.request.enhancer.SXPBlueprintSearchRequestEnhancerImpl._contributeSXPSearchRequestBodyContributors(SXPBlueprintSearchRequestEnhancerImpl.java:146)
      		... 116 more
      		Suppressed: com.liferay.search.experiences.internal.blueprint.exception.InvalidQueryEntryException: Invalid query entry at: 0
      			at com.liferay.search.experiences.internal.blueprint.exception.InvalidQueryEntryException.at(InvalidQueryEntryException.java:23)
      			at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor._processQueryEntry(QuerySXPSearchRequestBodyContributor.java:158)
      			at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor._processQueryEntries(QuerySXPSearchRequestBodyContributor.java:136)
      			at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor.contribute(QuerySXPSearchRequestBodyContributor.java:74)
      			... 117 more
      			Suppressed: com.liferay.search.experiences.internal.blueprint.exception.UnresolvedTemplateVariableException: Unresolved template variables: [user.id]
      				at com.liferay.search.experiences.internal.blueprint.exception.UnresolvedTemplateVariableException.with(UnresolvedTemplateVariableException.java:31)
      				at com.liferay.search.experiences.internal.blueprint.query.QueryConverter._validate(QueryConverter.java:92)
      				at com.liferay.search.experiences.internal.blueprint.query.QueryConverter._toTermQuery(QueryConverter.java:83)
      				at com.liferay.search.experiences.internal.blueprint.query.QueryConverter.toQuery(QueryConverter.java:53)
      				at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor._toComplexQueryPart(QuerySXPSearchRequestBodyContributor.java:201)
      				at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor.lambda$_process$1(QuerySXPSearchRequestBodyContributor.java:117)
      				at com.liferay.portal.kernel.util.ArrayUtil.isNotEmptyForEach(ArrayUtil.java:1171)
      				at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor._process(QuerySXPSearchRequestBodyContributor.java:113)
      				at com.liferay.search.experiences.internal.blueprint.search.request.body.contributor.QuerySXPSearchRequestBodyContributor._processQueryEntry(QuerySXPSearchRequestBodyContributor.java:163)
      				... 119 more
      

      Reproduced on:
      Portal master git commit 472f426f25c661944ecac0b7a39a9573d72ca32a

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              joshua.chong Joshua Chong
              Reporter:
              tibor.lipusz Tibor Lipusz
              Participants of an Issue:
              Recent user:
              Brian Lee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                19 weeks, 1 day ago

                  Packages

                  Version Package
                  7.4.13 DXP U5