2

Similar error from previously posted question but we aren't using any DD4T template building blocks in the page/component templates

Deserialize DD4T content error while validating DXA Model service

We can successfully publish json, txt and xml to the Broker database but can't load the files in a browser.

2018-06-08 15:25:04,729 DEBUG c.s.d.m.s.ContentService - Trying to request a 
page with localization id = '1109' and path = '/subdirectory/sample.json' 

2018-06-08 15:25:05,177 DEBUG c.s.d.m.s.ContentService - Requested 
publication 'xxxx', path '/subdirectory/sample.json', result is '[tcm:xxxx- 
xxxxxx-xx]' 

2018-06-08 15:25:05,419 INFO  c.s.d.m.s.DefaultPageModelService - Found DD4T 
model while requested R2, need to convert, no expansion needed, request 
PageRequestDto(publicationId=1109, uriType=tcm, 
path=/subdirectory/sample.json, includePages=INCLUDE, contentType=MODEL, 
dataModelType=R2, expansionDepth=100, 
depthCounter=com.sdl.dxa.common.dto.DepthCounter@9f) 

2018-06-08 15:25:05,570 INFO  o.d.d.s.j.TridionFieldTypeIdResolver - 
Instantiating TridionJsonFieldTypeResolver for [simple type, class 
org.dd4t.contentmodel.Field] 

2018-06-08 15:25:05,607 INFO  o.d.d.s.j.TridionFieldTypeIdResolver - 
Instantiating TridionJsonFieldTypeResolver for [simple type, class 
org.dd4t.contentmodel.Field] 

2018-06-08 15:25:05,661 INFO  o.d.d.s.j.TridionFieldTypeIdResolver - 
Instantiating TridionJsonFieldTypeResolver for [simple type, class 
org.dd4t.contentmodel.Field] 

2018-06-08 15:25:05,672 INFO  o.d.d.s.j.TridionFieldTypeIdResolver - Instantiating TridionJsonFieldTypeResolver for [simple type, class org.dd4t.contentmodel.Field] 

2018-06-08 15:25:05,681 INFO  o.d.d.s.j.TridionFieldTypeIdResolver - Instantiating TridionJsonFieldTypeResolver for [simple type, class org.dd4t.contentmodel.Field] 

2018-06-08 15:25:05,690 ERROR o.d.d.b.j.JsonDataBinder - Error deserializing. 
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "SampleField" (class org.dd4t.contentmodel.impl.PageImpl), not marked as ignorable (21 known properties: "Schema", "fileExtension", "CustomProperties", "lastPublishedDate", "Filename", "MetadataFields", "revisionDate", "Publication", "Folder", "Url", "OwningPublication", "Title", "Id", "Categories", "LastPublishedDate", "ExtensionData", "StructureGroup", "Version", "ComponentPresentations", "RevisionDate", "PageTemplate"])
 at [Source: (String)"{

Formatting the JSON as suggested in the previous post didn't fix the issue. In 2013 we would publish these files directly to the file system. We were told that is not an option using Topology Manager in Web 8.5.

1
  • Publishing to file system is still possible, but not supported by DXA. Commented Jun 9, 2018 at 8:48

2 Answers 2

3

DXA uses an MVC architecture; the data coming from CM is represented by a (Data) Model. These Data Models are expected to be in a certain (JSON) format. DXA 2.0 supports either DXA R2 format or DD4T format.

By default, the DXA Page Controller handles almost all URLs and expects the CM data to represent a Page Data Model (in either format).

If you want to serve any other CM data, you can’t use the DXA Page Controller, but you can create your own Controller or use DXA’s Static Content Item mechanism.

See also: JSON output from Tridion Java DXA 1.7

1

We were able to publish static files to the broker database using the same approach as the Publish Settings Page (Sdl.Web.Tridion.Templates).

Instead of publishing as a page, we published the files as binaries with the url set to the /_System/assets/ structure group.

protected const string JsonMimetype = "application/json";
protected const string JsonExtension = ".json";
....
string json = GetJSON();
Item jsonItem = package.CreateStringItem(ContentType.Text, json);
string filename = "filename";
StructureGroup structureGroup = m_Engine.GetObject(@"/webdav/" + GetPublication().Title + "/Home/_System/assets") as StructureGroup;
Binary jsonBinary = m_Engine.PublishingContext.RenderedItem.AddBinary(jsonItem.GetAsStream(),
            filename + JsonExtension, structureGroup, filename, GetComponent(), JsonMimetype);
jsonItem.Properties[Item.ItemPropertyPublishedPath] = jsonBinary.Url;
package.PushItem(jsonBinary.Url, jsonItem);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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