Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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 :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.