0

Has anyone seen this one before? It's complaining about no matching constructor, but the implementation class has no other constructor other than the default.

This is Sitecore 9.1.1 btw.

2456 03:00:22 WARN  Could not find constructor in ReflectionUtil.CreateObject: Availity9.ScheduledTasks.CacheWarmer. The constructor parameters may not match or it may be an abstract class. Parameter info: Count: 2. Parameter types: System.String, System.String

2456 03:00:22 ERROR Error while instantiating agent. Definition: web/sitecore/system/tasks/schedulestrue

Exception: Sitecore.Exceptions.ConfigurationException

Message: Could not create instance of type: Availity9.ScheduledTasks.CacheWarmer. No matching constructor was found.

Source: Sitecore.Kernel

   at Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)

   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)

   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert)

   at Sitecore.Tasks.Scheduler.ReadAgents()

Thanks, Bill

3
  • 1
    I don't anyone saw this cause it's in a custom class Availity9.ScheduledTasks.CacheWarmer. Check the code of that class and maybe add it to your question (with the task definition). Otherwise no one will be able to help you.
    – Marek Musielak
    Commented Feb 27, 2020 at 15:48
  • Thanks Marek, I meant if anyone has seen that error in general. So I put in it a constructor taking two string params. And now get different error "Message: Could not find property 'LogActivity' on object of type: Availity9.ScheduledTasks.CacheWarmer". Seems like it's expecting my class to inherit from something. Is that maybe something new and different in 9x? Commented Feb 27, 2020 at 19:01
  • Can you add the configuration of your agent and its code? Are you sure you want to register agent? Maybe you should work with scheduled job instead?
    – Marek Musielak
    Commented Feb 27, 2020 at 20:23

1 Answer 1

0

Ok so I learned that in the config entry, tags become parameters that your method signature must have. Other tags within the entry must be properties in your implementation class.

It's a whole other story if you define the tasks in CMS system->Tasks (Commands and Schedules).

In my case I didn't need any of the parameters or properties that were in the examples I'd found online.

And naturally I was defining the tasks both in CMS and config, and was getting errors from both.

Then I happened upon an article that boils it down to the simplest way of implementing a task and defining it in a config patch at Jon D Jones site:

https://www.jondjones.com/learn-sitecore-cms/sitecore-developers-guide/sitecore-events/how-to-set-up-a-scheduled-task-in-sitecore

Once I deleted the CMS commands and schedules and implemented the simple way, all works fine. The only caveat would be the xdt:Transform="Insert" property in his tag. That gave me an error and I just removed it and all was fine.

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.