4

I just setup a basic DXA Webapp 2.0.0 trying to get data from microservices hooked up with SDL Web 8.5 and I am trying to run it but I get a Null Pointer Exception. The DXA components were installed on the CM and all the necessary files have been published too.

Also, the CM is installed on a Windows machine and the microservices are on a Linux box.

I do see the Webapp is making a request with a URL to the content service, one with V2 and the other with V4. When I try to hit the URL with V2 in my browser it results in no resource found

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code></code>
    <message xml:lang="en-US">Unable to build binary entry: No resource was found for the requested item</message>
</error>

But when I hit the v4 URL, I actually get data.

<metadata:value xmlns:data="http://docs.oasis-open.org/odata/ns/data" xmlns:metadata="http://docs.oasis-open.org/odata/ns/metadata" metadata:context="http://hostname:18081/client/v4/content.svc/$metadata#Edm.String">
{"CLASSNAME":"ComponentMetaImpl","INSTANCE":{"schemaId":7818,"isMultimedia":true,"namespaceId":1,"id":7819,"type":16,"publicationId":123,"owningPublicationId":2,"majorVersion":1,"minorVersion":0,"title":"Core","modificationDate":"2018-05-22 14:26:34.000","initialPublicationDate":"2018-05-24 11:35:54.032","lastPublicationDate":"2018-05-29 12:39:03.737","creationDate":"2018-05-22 14:26:34.000","categories":[],"author":"ABC\\user1","customMeta":{"name":"custom-meta","nameValues":{},"children":{}},"loadCustomMetas":false}}
</metadata:value>

The URL for V2 is http://hostname:18081/client/v2/content.svc/BinaryContents%28PublicationId%3D123%2CBinaryId%3D7819%2CVariantId%3DY29uZmlnLWJvb3RzdHJhcA%3D%3D%2CStreamContent%3Dfalse%29

and the URL for V4 is http://hostname:18081/client/v4/content.svc/GetComponentMetaFunctionImport(ComponentId=7819,PublicationId=123)

The publication id is 123 and the Component it is trying to get is 7819, which is the Core component.

NOTE: When I try it on a different instance of SDL Web 8.5, both the requests work.

Can someone help me as to why I am not able to hit the V2 URL in the above instance? And if that might be the issue why I am getting a Null Pointer Exception in the DXA Webapp?

1
  • It seems the Binary is not present in the Broker DB. Did you configure your Deployer to store Binaries in the DB (rather than on filesystem)? Commented May 30, 2018 at 6:20

1 Answer 1

4

As Rick mentioned, my Deployer Storage config had these lines:

 <ItemTypes cached="true" defaultStorageId="reldeployerdb">
    <Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
    <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    <Publication Id="84" cached="true" defaultStorageId="reldeployerdb">
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    </Publication>
    <Publication Id="101" cached="true" defaultStorageId="reldeployerdb">
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    </Publication>
</ItemTypes>

So, typeMapping="Page" is what forces the Binaries to be stored in the file system. Commenting out everything in the ItemTypes tag worked for me

 <ItemTypes cached="true" defaultStorageId="reldeployerdb">
    <!--<Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
    <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    <Publication Id="84" cached="true" defaultStorageId="reldeployerdb">
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    </Publication>
    <Publication Id="101" cached="true" defaultStorageId="reldeployerdb">
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Page"/>
        <Item cached="true" storageId="relpublishedfiles" typeMapping="Binary"/>
    </Publication>-->
</ItemTypes>

Now I have data coming up on the V2 request too.

Thanks Rick.

2
  • isn't it typeMapping="Binary" that is forcing binaries to be stored in DB ? Commented May 31, 2018 at 14:52
  • It is trying forcing to write to the file system first. Probably the issue might be the order of those statements.But removing them all together worked for me. Commented May 31, 2018 at 15:45

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.