12

While creating a basic test for a client which requires the Profiling and Personalization module to show components based on user visiting certain pages, I stumbled upon a very persistent null reference error trying to retrieve the page which has some tracked components on them.

What I have now:

  • A win 2008 R2 server with IIS 7.5 and Tridion 2011 SP1
  • A staging environment of our test ASPX/.Net website running Integrated Mode

What I did:

What happens nonetheless:

As soon as I add a Component Presentation to a page and publish it, I get the following error:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Tridion.ContentDelivery.Web.WAI.WAIPage..ctor(String tcmUri, HttpContext httpContext) +291
       Tridion.ContentDelivery.Web.UI.TargetGroup.Render(HtmlTextWriter writer) +304
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +149 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +149
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +248
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +394

As soon as i take the component out again and i republish, i get my site back.

Any Idea what I misconfigured?

EDIT -

This is my typemapping:

<ItemTypes defaultStorageId="sqlserver" cached="false">
      <Item typeMapping="Page" storageId="iisFile" cached="true"/>
      <Item typeMapping="Binary" storageId="iisFile" cached="true"/>
  </ItemTypes>

and this is my conditionals for Target Group:

Target Group Conditional

And this is the actual conditional on the page itself:

<tridion:TargetGroup runat="server" ItemURI="tcm:21-23153-64">
<tridion:Conditions runat="server" Negate="false" Operator="AND">
<tridion:Conditions runat="server" Negate="false" Operator="OR">
<tridion:Conditions runat="server" Negate="false" Operator="AND">
<tridion:Condition runat="server" Type="TrackingKey" Operator="&gt;" Negate="false" Name="Grass" Value="20"/>
</tridion:Conditions>
</tridion:Conditions>
</tridion:Conditions>
<tridion:TargetGroup runat="server" ItemURI="tcm:21-23153-64">
<tridion:Conditions runat="server" Negate="false" Operator="AND">
<tridion:Conditions runat="server" Negate="false" Operator="OR">
<tridion:Conditions runat="server" Negate="false" Operator="AND">
<tridion:Condition runat="server" Type="TrackingKey" Operator="&gt;" Negate="false" Name="Grass" Value="20"/>
</tridion:Conditions>
</tridion:Conditions>
</tridion:Conditions>
6
  • Is the page stored on the filesystem or dB? (Assuming file system). Can you share what the target group conditions are? Also the markup on the published page with the wai conditional server controls? Commented Aug 13, 2014 at 12:46
  • What's interesting is that the WAIPage constructor is throwing your null pointer error (second line in the stack trace). Commented Aug 13, 2014 at 12:51
  • Updated my post, hope that clearifies some things.
    – MDa
    Commented Aug 13, 2014 at 12:54
  • Also noticed that if I take the Conditional tags out of the source of the page, it starts working again.
    – MDa
    Commented Aug 13, 2014 at 13:12
  • Can you check cd_core.log (I forget, but there might be a separate wai.log file as well)? We should see some java layer stuff that might be helpful. Commented Aug 13, 2014 at 15:31

3 Answers 3

3

The commonest cause of null reference exceptions coming from Tridion Content Delivery code is incorrect configuration. This usually means that an expected XML element or attribute can't be found. (I imagine if they checked the result of every XPath, things would be better.) I would suggest the following:

  1. Schema validate your configuration files - the schemas are shipped with the rest of the content delivery files.
  2. Check the files carefully by hand.
  3. If 1 and 2 don't help, double check that the files are saved in the correct encoding.
1
  • I've completed your first tip, which is something I'm going to keep in mind as I never knew I could (though keeping in mind XSD's can also be updated through a hotfix, good to know as well). I did find discrepancies on some configs, which I corrected, but after restarting pretty much every service and site the error persists. Your second one is pretty much what I did all afternoon, and tried several suggested fixes. The encoding one I haven't tried yet, but I'd say the rest of the site would fall apart if this was the case in the first place, right?
    – MDa
    Commented Aug 14, 2014 at 12:35
1

The exception is being thrown in the constructor of WAIPage. The constructor accepts an HTTPContext as a parameter. If this parameter is null, this will cause the problem you are reporting.

It's a real shame that your Tridion license won't allow you to simply decompile Tridion.ContentDelivery.Web.WAI.WAIPage and look at its constructor. I've found that staring really, really hard at the DLL and imagining what might be in the code works almost as well. If you are really good at imagining, you might come up with another couple of possible null reference exceptions.

1
  • We noticed the same, and we understood that we perhaps had to use the Force to feel our way through the code. Our path guided us to several possible outcomes, but none yielded any results when we tried them on the fly on our faulty page. I'm starting to fear that our libraries might be out of date, inconsistent or perhaps not properly patched.
    – MDa
    Commented Aug 18, 2014 at 7:17
1

It's been a while, but I seem to have 'solved' my issue when I started working on it again - I've opened up the Web App log file for a fresh peek and I noticed this ERROR suddenly after the CD WAI gets initialized.

ERROR LicenseReader - Could not find the license file file:/c:/windows/system32/inetsrv/cd_licenses.xml

Yep, all kinds of wrong.

As you might imagine SDL support did not find this error since it is well-known that commenting out your license reference in your cd_wai_conf.xml simply reverts to either the Tridion HOME environment var to check there or the Tridion Install folder itself. Except, this time, it simply was looking for it in a complete different location.

It's embarrassing I'll admit, but that does not keep me from sharing this piece of insight with you.

And of course, after that, double check why my app finds the c:/windows/system32 folder so insanely interesting. And why I'm getting a

2014-10-22 16:08:35,574 DEBUG StorageManagerFactory - Loading a non cached DAO for publicationId/typeMapping/itemExtension: 0 / Personalization / null
2014-10-22 16:08:35,574 ERROR UserManager - No Data Access Object for Personalization
com.tridion.broker.StorageException: No Data Access Object for Personalization
    at com.tridion.storage.filesystem.FSDAOFactory.getDAOForTypeMapping(FSDAOFactory.java:177) ~[cd_datalayer.jar:na]
    at com.tridion.storage.StorageManagerFactory.getOriginalDAO(StorageManagerFactory.java:465) ~[cd_datalayer.jar:na]
    at com.tridion.storage.StorageManagerFactory.getDAO(StorageManagerFactory.java:271) ~[cd_datalayer.jar:na]
    at com.tridion.storage.StorageManagerFactory.getDefaultDAO(StorageManagerFactory.java:178) ~[cd_datalayer.jar:na]
    at com.tridion.user.UserManager.checkUser(UserManager.java:56) ~[cd_wai.jar:na]

Error. But that's another matter.

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.