2

I am following the below url to configure DD4T 2.0 to consume DXA Model Service: http://blog.trivident.com/switching-to-the-dxa-2-model-service-in-your-dd4t-application/

As per above article, when we try to validate the Model Service to read content published from DD4T 2.0 templates using Postman, we are getting the below error:

{
    "timestamp": [
        "String",
        "2018-06-01T07:50:12.821+0000"
    ],
    "status": 500,
    "error": "Internal Server Error",
    "exception": "com.sdl.webapp.common.api.content.ContentProviderException",
    "message": "Couldn't deserialize DD4T content for request PageRequestDto(publicationId=32, uriType=tcm, path=/somepage/index.htm, includePages=INCLUDE, contentType=MODEL, dataModelType=R2, expansionDepth=100, depthCounter=com.sdl.dxa.common.dto.DepthCounter@9f)",
    "path": "/PageModel/tcm/32/somepage/index.htm"
}

The content is coming fine when we are using the content service URL in compressed JSON format

Updated v2: Updated the logback of model service - debug mode.

The logs genrated in dxa.date.log shows below error:

DEBUG c.s.d.m.s.ContentService - Trying to request a page with localization id = '32' and path = '/somepage/index.htm' 

DEBUG c.s.d.m.s.ContentService - Requested publication '32', path '/somepage/index.htm', result is '[tcm:xx-xxxxxx-xx]'

INFO  c.s.d.m.s.DefaultPageModelService - Found DD4T model while requested R2, need to convert, no expansion needed, request PageRequestDto(publicationId=32, uriType=tcm, path=/somepage/index.htm, includePages=INCLUDE, contentType=MODEL, dataModelType=R2, expansionDepth=100, depthCounter=com.sdl.dxa.common.dto.DepthCounter@9f) 

ERROR o.d.d.b.j.JsonDataBinder - Error deserializing. 
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'H4sIAAAAAAAEAO1d647bOJZ': was expecting ('true', 'false' or 'null')
 at [Source: (String)"H4sIAAAAAAAEAO1d647bOJZ+Fa5.......tNXVVEErz59eAs+"[truncated 10300 chars]; line: 1, column: 24]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
    ......

Can you please help in resolving the above error.

  • Try to enable the DEBUG log mode on DXA model service on logback.xml to troubleshoot, I suspect some of the dependency may be not published, during the View Model build getting an exception, – Velmurugan Jun 1 '18 at 14:45
  • @Velmurugan I have updated the question and provide the logs . As I understand from the article , we dont' need to actually publish the previous content , as the model service can consume DD4T 2 data format . – Sayoni Jun 4 '18 at 7:47
  • 1
    I'm not sure, what is wrong in your JSON here clearly something wrong with your published JSON data, you can disable the compress JSON output on the DD4T templates on both CT and PT and republish the page to access to check the logs files, maybe will get bit more detail on this issue. – Velmurugan Jun 4 '18 at 12:22
  • Yes , by removing the compression from the DD4T templates , the model service is fetching the content . It worked . But , does that mean that the model service won't be able to consume compressed JSON ? Is there any additional configuration to make it work (with the existing dd4t format) – Sayoni Jun 5 '18 at 11:09
  • Maybe that DD4T compressed JSON doesn't work, indeed, you can create an Issue on GitHub on this link github.com/sdl/dxa-model-service/issues – Velmurugan Jun 5 '18 at 15:55
1

It's related to DD4T compressed JSON.

To fix this issue disable the compress JSON output on the DD4T templates on both CT and PT and republish the pages and DCPs.

Model Service supports DXA R2 format and DD4T format, maybe not compressed output.

DXA 2 data format is more compact and will probably make publishing a bit faster. you might consider to replace the DD4T template building blocks with the new DXA R2 TBBs and republish all your pages.

I hope it helps.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.