0

I have an issue on my SharePoint 2007 portal, where i created a custom TimerJob, but when I deploy it i get a message:

MyTimerJob cannot be deserialized because it does not have a public default constructor.

I perfromed a research and i applied some solutions where provided but I still have the same issue!

Here is the code:

public CustomTimerJob()
    : base()
 { }

public CustomTimerJob(string name, SPService service, SPServer server, SPJobLockType lockType) :
     base(name, service, server, lockType)
  {}

public CustomTimerJob(string name, SPWebApplication webApplication) :
   base(name, webApplication, null, SPJobLockType.ContentDatabase)
{
    this.Title = "XML Retriever";
}

public override void Execute(Guid contentDbId)
{
  //Perfrom work
}

And here is my feature activation:

    MyTimerJob customTimerJob = new MyTimerJob(JOB_NAME, site.WebApplication);

    SPMinuteSchedule schedule = new SPMinuteSchedule();
    schedule.BeginSecond = 0;
    schedule.EndSecond =50;
    schedule.Interval = 50;
    customTimerJob.Schedule = schedule;

    customTimerJob.Update();

Anyone has any idea what the problem could be?

1 Answer 1

0

Try removing

public CustomTimerJob(string name, SPService service, SPServer server, SPJobLockType lockType) :
     base(name, service, server, lockType)
  {}

and changing

MyTimerJob customTimerJob = new MyTimerJob(JOB_NAME, site.WebApplication);

to

MyTimerJob customTimerJob = new MyTimerJob(site.WebApplication);

Also attach your solution to OWSTimer.EXE and see where exactly its getting stuck.

Hope it helps :)

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.