dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
864 stars 466 forks source link

Legacy Relationships do not pull correctly - was getRelated errors on Null values #17362

Closed wezell closed 5 years ago

wezell commented 5 years ago

Found during the upgrade of dotCMS authoring environment. Legacy relationships do not seem to work - you can see the resulting documentation page here:

Screen Shot 2019-09-26 at 9 02 18 AM

dotcms_1  | 19:52:16.709  ERROR servlet.MainServlet - Unable to look up related content for contentlet with identifier 67ac3ab7-81ab-4d2c-bba7-afb459aaa7eb. Relationship name: DocParent-DocChild
dotcms_1  | com.dotmarketing.exception.DotDataException: Unable to look up related content for contentlet with identifier 67ac3ab7-81ab-4d2c-bba7-afb459aaa7eb. Relationship name: DocParent-DocChild
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent_aroundBody68(ESContentletAPIImpl.java:1639)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure69.run(ESContentletAPIImpl.java:1)
dotcms_1  |     at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
dotcms_1  |     at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42)
dotcms_1  |     at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29)
dotcms_1  |     at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent(ESContentletAPIImpl.java:1608)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent(ESContentletAPIImpl.java:1603)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent(ESContentletAPIImpl.java:1656)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.pullRelated(ESContentletAPIImpl.java:1354)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getAllRelationships_aroundBody56(ESContentletAPIImpl.java:1330)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure57.run(ESContentletAPIImpl.java:1)
dotcms_1  |     at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
dotcms_1  |     at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42)
dotcms_1  |     at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29)
dotcms_1  |     at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getAllRelationships(ESContentletAPIImpl.java:1302)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getAllRelationships_aroundBody54(ESContentletAPIImpl.java:1291)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure55.run(ESContentletAPIImpl.java:1)
dotcms_1  |     at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
dotcms_1  |     at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42)
dotcms_1  |     at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29)
dotcms_1  |     at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getAllRelationships(ESContentletAPIImpl.java:1289)
dotcms_1  |     at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.getAllRelationships(ContentletAPIInterceptor.java:1002)
dotcms_1  |     at com.dotmarketing.portlets.contentlet.action.EditContentletAction._loadContentletRelationshipsInRequest(EditContentletAction.java:950)
dotcms_1  |     at com.dotmarketing.portlets.contentlet.action.EditContentletAction._retrieveWebAsset(EditContentletAction.java:880)
dotcms_1  |     at com.dotmarketing.portlets.contentlet.action.EditContentletAction.processAction(EditContentletAction.java:307)
dotcms_1  |     at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:124)
dotcms_1  |     at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:120)
dotcms_1  |     at com.liferay.portlet.ConcretePortletWrapper.processAction(ConcretePortletWrapper.java:97)
dotcms_1  |     at com.liferay.portal.action.LayoutAction._processPortletRequest(LayoutAction.java:194)
dotcms_1  |     at com.liferay.portal.action.LayoutAction._processActionRequest(LayoutAction.java:206)
dotcms_1  |     at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:82)
dotcms_1  |     at com.dotcms.repackage.org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
dotcms_1  |     at com.dotcms.repackage.org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237)
dotcms_1  |     at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:147)
dotcms_1  |     at com.dotcms.repackage.org.apache.struts.action.ActionServlet.process(ActionServlet.java:1202)
dotcms_1  |     at com.dotcms.repackage.org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
dotcms_1  |     at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
dotcms_1  |     at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:242)
dotcms_1  |     at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:442)
dotcms_1  |     at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at com.dotcms.repackage.com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:135)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at com.dotmarketing.filters.CMSFilter.doFilterInternal(CMSFilter.java:191)
dotcms_1  |     at com.dotmarketing.filters.CMSFilter.doFilter(CMSFilter.java:47)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at com.dotcms.filters.interceptor.AbstractWebInterceptorSupportFilter.doFilter(AbstractWebInterceptorSupportFilter.java:90)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at com.dotcms.filters.interceptor.AbstractWebInterceptorSupportFilter.doFilter(AbstractWebInterceptorSupportFilter.java:90)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
dotcms_1  |     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
dotcms_1  |     at com.dotmarketing.cms.urlmap.filters.URLMapFilter.doFilter(URLMapFilter.java:98)
dotcms_1  |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
dotcms_1  |     at java.lang.Thread.run(Thread.java:748)
dotcms_1  | Caused by: java.lang.NullPointerException
dotcms_1  |     at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:888)
dotcms_1  |     at com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.add(ImmutableCollection.java:468)
dotcms_1  |     at com.google.common.collect.ImmutableList$Builder.add(ImmutableList.java:736)
dotcms_1  |     at com.dotcms.util.CollectionsUtils$ImmutableListCollector.lambda$0(CollectionsUtils.java:937)
dotcms_1  |     at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
dotcms_1  |     at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
dotcms_1  |     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
dotcms_1  |     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
dotcms_1  |     at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
dotcms_1  |     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
dotcms_1  |     at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.filterRelatedContent_aroundBody66(ESContentletAPIImpl.java:1466)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure67.run(ESContentletAPIImpl.java:1)
dotcms_1  |     at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
dotcms_1  |     at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42)
dotcms_1  |     at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29)
dotcms_1  |     at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.filterRelatedContent(ESContentletAPIImpl.java:1442)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getNonCachedRelatedContentlets(ESContentletAPIImpl.java:3056)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent_aroundBody106(ESContentletAPIImpl.java:2984)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure107.run(ESContentletAPIImpl.java:1)
dotcms_1  |     at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
dotcms_1  |     at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42)
dotcms_1  |     at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29)
dotcms_1  |     at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent(ESContentletAPIImpl.java:2940)
dotcms_1  |     at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.getRelatedContent_aroundBody68(ESContentletAPIImpl.java:1626)
dotcms_1  |     ... 107 more
nollymar commented 5 years ago

PRs: https://github.com/dotCMS/core/pull/17369/ https://github.com/dotCMS/core/pull/17393

erickgonzalez commented 5 years ago

Pulling related content without issues using velocity https://dotcms.com/docs/latest/pull-and-display-related-content with legacy and new relationships.

bryanboza commented 5 years ago

Fixed, tested on demo with the provided link