2

Been struggling with this problem for a while. I'm deploying a custom timer job to SharePoint Foundation 2010, initially using the tutorial here. This timer job is supposed to add an element to a SharePoint list every 5 minutes. I haven't explicitly defined a separate SharePoint project for the timer job, I'm adding it through my existing project.

I have one class, TlJob, which overrides SPJobDefinition and contains the code to be executed, and a feature TlJobFeature implementing the event receivers that add TlJob to the web application's job definition list.

As far as I can tell from the logs, the feature is deployed correctly when I build and deploy the solution. The TlJobFeature feature is added to the Site Collection Features and marked as activated, and it also shows up in Central Administration. However, no new elements are added to the specified list. The log file shows a number of error messages like these:

04/12/2011 08:55:40.90  OWSTIMER.EXE (0x07B0)                       0x0DD4  SharePoint Foundation           Topology                        umbo    High        The type MonitorDisplayPages.TlJob, MonitorDisplayPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=991fdf04053037d6 could not be found in its specified assembly.  Scanning all assemblies that have been loaded in the current app domain.   
04/12/2011 08:55:41.47  SPUCHostService.exe (0x04E8)                0x1A14  SharePoint Foundation           Topology                        umbp    High        The type MonitorDisplayPages.TlJob, MonitorDisplayPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=991fdf04053037d6 (Id = 43ce829d-8acd-3582-920d-e5e658cce2a2) could not be located in any loaded assembly.

It would seem like the code for the TlJob class might not have been deployed to the GAC, so I added the following line to the post-build script:

@echo *** Adding assembly to GAC
"$(FrameworkSDKDir)bin\gacutil.exe" /i "$(TargetPath)"

However, this doesn't solve the problem. Searching google for the error message above returns only a single result, with three or four people having the problem and no responses.

1 Answer 1

3
  • Is TlJobFeature being activated as a user with access to your config database?

sounds like it is, but just check

  • Are you restarting the timer service when you deploy the assembly?

    net stop sptimerv4

    net start sptimerv4

  • check c:\windows\assembly to make sure you assembly is in the GAC

  • is it a multi server environment, check it is being deployed to all servers

3
  • Great, thanks! Restarting the timer service did the trick. One confusing bit, though, is that the error messages above still show up in the logs. You would think that SharePoint either finds the class or it doesn't. Commented Apr 12, 2011 at 8:00
  • the job class name is registered as a string in the content database. when the timer trys to run the job, it first gets the string from the database, then trys to load the class, which it can not find. it knows the class name, so it can output it to the log file (this is a simplistic view)
    – djeeg
    Commented Apr 12, 2011 at 8:07
  • Thanks a lot djeeg. I also faced same issue. Didn't expect SharePoint Timer Job Service causing this. I used to restart Timer Job Service once I re-deploy timer job wsps. But this happened before creation of Timer Job. However Restarting Timer Job Service is the Solution for this Issue
    – user3680
    Commented Jun 9, 2011 at 11:40

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.