3

When I use ComponentPresentationAssembler to get the content of a Dynamic Component Presentation with output format "Xml Document", a NullPointerException occurs on the Content Service.

If I change the Output Format to "Html Document" for example, then all works fine. All DCPs are published to the database.

The system is an SDL Web8 instance, using Content Delivery CIL, .NET API.

The .NET code:

ComponentPresentationFactory compFactory = new ComponentPresentationFactory(PublicationURI.ItemId);
ComponentPresentation cp = compFactory.GetComponentPresentationWithOutputFormat(articleId, "Xml Document");
ComponentPresentationAssembler assembler = new ComponentPresentationAssembler();
TcmUri compUri = new TcmUri(theme.PublicationURI.ItemId, cp.ComponentId, 16, 0);
TcmUri tempUri = new TcmUri(theme.PublicationURI.ItemId, cp.ComponentTemplateId, 32, 0);
String content = assembler.GetContent(compUri.ToString(), tempUri.ToString());

On the Content Service, the logs show the following stacktrace:

2017-02-22 14:45:20,425 ERROR ODataFunctionProcessorImpl - Unexpected exception when executing a function.
java.lang.NullPointerException: null
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:85) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:42) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.ContentServiceOperation.doOperation(ContentServiceOperation.java:36) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.odata.processor.ODataFunctionProcessorImpl.doFunction(ODataFunctionProcessorImpl.java:63) ~[odata_processor-2.0.5-1002.jar:2.0.5-1002]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor$$anonfun$receive$1.applyOrElse(ODataQueryProcessorActor.scala:36) [odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:480) [akka-actor_2.11-2.4.1.jar:na]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor.aroundReceive(ODataQueryProcessorActor.scala:29) [odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) [akka-actor_2.11-2.4.1.jar:na]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) [akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) [akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) [akka-actor_2.11-2.4.1.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_111]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_111]
2017-02-22 14:45:20,432 DEBUG ODataMessageRouter - Sending error message for exception:
java.lang.NullPointerException: null
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:85) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:42) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.ContentServiceOperation.doOperation(ContentServiceOperation.java:36) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.odata.processor.ODataFunctionProcessorImpl.doFunction(ODataFunctionProcessorImpl.java:63) ~[odata_processor-2.0.5-1002.jar:2.0.5-1002]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor$$anonfun$receive$1.applyOrElse(ODataQueryProcessorActor.scala:36) ~[odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:480) ~[akka-actor_2.11-2.4.1.jar:na]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor.aroundReceive(ODataQueryProcessorActor.scala:29) ~[odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) ~[akka-actor_2.11-2.4.1.jar:na]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) ~[akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) ~[akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) ~[akka-actor_2.11-2.4.1.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_111]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_111]
2017-02-22 14:45:20,433 ERROR ODataRendererActor - Unexpected exception during response rendering - java.lang.NullPointerException: 'null'
java.lang.NullPointerException: null
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:85) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.function.dynamic.GetComponentPresentationContentFunction.doContentServiceOperation(GetComponentPresentationContentFunction.java:42) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.web.content.odata.ContentServiceOperation.doOperation(ContentServiceOperation.java:36) ~[content-common-8.1.1-1008.jar:8.1.1-1008]
    at com.sdl.odata.processor.ODataFunctionProcessorImpl.doFunction(ODataFunctionProcessorImpl.java:63) ~[odata_processor-2.0.5-1002.jar:2.0.5-1002]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor$$anonfun$receive$1.applyOrElse(ODataQueryProcessorActor.scala:36) ~[odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:480) ~[akka-actor_2.11-2.4.1.jar:na]
    at com.sdl.odata.service.actor.ODataQueryProcessorActor.aroundReceive(ODataQueryProcessorActor.scala:29) ~[odata_service-2.0.5-1002.jar:2.0.5-1002]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) [akka-actor_2.11-2.4.1.jar:na]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) [akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) [akka-actor_2.11-2.4.1.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) [akka-actor_2.11-2.4.1.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_111]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_111]

Has anybody seen this before? Is this a bug? Is there a fix?

  • 1
    You're very diplomatic, Mihai. A null pointer exception is always a bug. :-) – Dominic Cronin Feb 23 '17 at 20:51
  • Please check null condition, before passing parameters. – Sudhakar Rao Feb 23 '17 at 23:47
  • Getting softer, as I age.. that's what I am :)) Also all parameters are correct, not null. – Mihai Cădariu Feb 24 '17 at 7:52
  • You've not got one of those flipping (optional) embedded schema with mandatory field (not-populated) have you? – Dylan .. Mark Saunders Feb 24 '17 at 8:46
  • Nothing like that. I reproduced it with a very simple 1 field optional schema too. Very likely a bug. – Mihai Cădariu Feb 26 '17 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.