Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-14299

NullPointerException in HstActionProvider, no menu in Exp. Manager

    XMLWordPrintable

Details

    • Flagged

    Description

      In a case where a certain mount is configured in two different host groups, a browser XHR call from the Exp. Mgr. like this

      http://localhost:8080/cms/_rp/<page-uui>./item/<sitemapitem-uuid>
      

      returns a 500 code with a NullPointerException. Then the top menu with "Channel" and "Page" isn't showing, making it impossible to Publish changes. 

      The reason is that in org.hippoecm.hst.pagecomposer.jaxrs.services.component.ChannelContextFactory#make the correct channel isn't found in the following code, since the mount id is the node uuid from the wrong host group:

      final Optional<Channel> channelOptional = channelService.getChannelByMountId(actionContext.getMountId(), actionContext.getHostGroup());
      
      if (!channelOptional.isPresent()) {
          return channelContext;
      }
      
      .. normal continuation with channelContext.setChannel(channel)
      

      Reproduction
      In an archetype project

      • copy /hst:myproject/dev-localhost to /hst:myproject/hst:hosts/dev-local
      • open the site channel in the Exp. Mgr.

      ==> see the 500 in the _rp call in the browser and the stack trace in the console

      Suggestion
      Let's add both happy-path logging and a WARN if the channel isn't found.

      Stack strace

      [catalina-exec-3] WARN  [org.hippoecm.hst.pagecomposer.jaxrs.services.AbstractConfigResource.logAndReturnServerError():222] java.lang.NullPointerException
      java.lang.NullPointerException: null
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.component.HstActionProvider.channelActions(HstActionProvider.java:55) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.component.HstActionProvider.getActions(HstActionProvider.java:36) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.component.HstActionStateProvider.getActionState(HstActionStateProvider.java:33) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.component.ActionStateServiceImpl.lambda$getActionState$0(ActionStateServiceImpl.java:44) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_201]
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[?:1.8.0_201]
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_201]
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_201]
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_201]
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_201]
      	at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:479) ~[?:1.8.0_201]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.component.ActionStateServiceImpl.getActionState(ActionStateServiceImpl.java:46) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.ComponentResource.lambda$getActionsAndStates$0(ComponentResource.java:87) ~[hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.AbstractConfigResource.tryGet(AbstractConfigResource.java:148) [hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.services.ComponentResource.getActionsAndStates(ComponentResource.java:68) [hst-page-composer-14.3.2.jar:14.3.2]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]
      	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) [cxf-rt-frontend-jaxrs-3.3.6.jar:3.3.6]
      	at org.hippoecm.hst.jaxrs.cxf.AroundProcessableJAXRSInvoker.invoke(AroundProcessableJAXRSInvoker.java:94) [hst-jaxrs-14.3.2.jar:14.3.2]
      	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) [cxf-rt-frontend-jaxrs-3.3.6.jar:3.3.6]
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.3.6.jar:3.3.6]
      	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.3.6.jar:3.3.6]
      	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.3.6.jar:3.3.6]
      	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.3.6.jar:3.3.6]
      	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.3.6.jar:3.3.6]
      	at org.hippoecm.hst.jaxrs.cxf.CXFJaxrsService.invoke(CXFJaxrsService.java:128) [hst-jaxrs-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.pagecomposer.jaxrs.cxf.CXFJaxrsHstConfigService.invoke(CXFJaxrsHstConfigService.java:227) [hst-page-composer-14.3.2.jar:14.3.2]
      	at org.hippoecm.hst.core.container.JaxrsRestServiceValve.invoke(JaxrsRestServiceValve.java:38) [hst-core-14.3.2.jar:14.3.2]
      

      Attachments

        Activity

          People

            jhoffman Jeroen Hoffman
            jhoffman Jeroen Hoffman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: