Could not instantiate event handler. Type: Sitecore.Publishing.HtmlCacheClearer
Asked Answered
M

2

7

It was all of a sudden and it just stopped working. I have no clue what went wrong, what caused this to occur:

Could not instantiate event handler. Type: Sitecore.Publishing.HtmlCacheClearer. Method: ClearCaches (method: Sitecore.Events.Event+EventSubscribers.Add(String eventName, XmlNode configNode)).

I tried everything that would make it work but it didn't

  1. Re-copied my Sitecore files from Sitecore 7.2
  2. Re-Indexed my Solr
  3. Created a completely new Sitecore project
  4. Republished the complete site
  5. Banged my head on the desk

Can anyone tell me the reason for this and what could be the solution. I am fairly new to Sitecore.

Updating the publish:end and publish:end:remote

 <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCaches">
      <sites hint="list">
        <site>website</site>
      </sites>
    </handler>
  </event>
  <event name="publish:end:remote">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCaches">
      <sites hint="list">
        <site>website</site>
      </sites>
    </handler>
  </event>
Megohm answered 16/1, 2016 at 14:7 Comment(3)
Are you sure you copied the files over from the correct version of Sitecore? Double check the version of Sitecore.Kernel.dll you have deployed and the version you have referenced in your VS project.Natica
Hi Jammy. I am referencing the correct version.Megohm
Can you update the question with the XML for the publish:end and publish:end:remote events?Calaboose
W
6

I may be wrong but could it be a simple spelling mistake in the handler registration in the events pipeline? I looked at the source code for SC 7.2 update 4 and there is no method called Sitecore.Publishing.HtmlCacheClearer.ClearCaches, how ever there IS a method called ClearCache.

Try to change the method name to ClearCache.

Cheers, Bo

Waylonwayman answered 18/1, 2016 at 15:17 Comment(6)
And ClearCache is also the default set in Sitecore config. Nice spot.Natica
I tried refactor rename all the occurrences. But it didn't worked. Currently I just commented out the publish:end and publish:end:remote to stop myself being blocked.Megohm
One more thing to point out is: We have the same Sitecore project created for 2 different regions and they have different deploy locations. What surprises me is that the other deployed solution is working fine.Megohm
Hello Bo, since this is just a temporary work-around, can you suggest what else can be done here ?Megohm
Hi Todd, the HtmlCacheClearer class is a standard Sitecore class with the method ClearCache. Have you checked that the spelling is correct in the event hookups in the web.config? It should be <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">. You shouldn't need to refactor any of your code.Waylonwayman
This seems to be weird. But now it is working without changing the class name as suggested by Bo. What I did is just uncommented the publish:end and publish:end:remote in the Web.config. I worked for couple of days by commenting these items. but now its working. This is really weird. But I will accept this answer so anyone can try this as well as what I did.Megohm
C
1

This is a long shot, but I encountered a problem with the HtmlCacheClearer a few months back. Turns out it has a dependency on a legacy Lucene index called __System.

If that index get corrupted, it can cause some unexpected results. My situation wasn't exactly the same as yours but the fix simple and non-invasive. So it might be worth trying.

Just delete the __System index from you datafolder (it doesn't contain anything that needs to be kept).

I wrote a blog post about this issue.

Calaboose answered 16/1, 2016 at 19:28 Comment(1)
Hi Martin. I deleted the __System file from my data folder, but still its not working.Megohm

© 2022 - 2024 — McMap. All rights reserved.