locked
Problem after WSP job timer add / install RRS feed

  • Question

  • Hi,

    I am developping a job timer for Sharepoint 2010. Its scope is site. By default, the job is disabled : the user has to enable it in SharePoint 2010 central administration > Monitoring > Job Definitions.

    So, I installed WSPBuilder to create the WSP file in Visual Studio. Then, I installed the WSP file on a test environment , with commands :

    Add-SPSolution –LiteralPath "C:\Deployment\MySolutionPackage.wsp"

    Install-SPSolution –Identity MySolutionPackage.wsp –GACDeployment

     

    The problem is that I don't see my job timer in Job Definitions list. Any ideas ?

    thx

    • Edited by Zino_o Wednesday, December 7, 2011 6:02 PM
    Wednesday, December 7, 2011 6:01 PM

Answers

  • OK found the solution. It is silly ...

    I was using the add-in WSP builder for Visual Studio to generate the WSP package but it was missing the feature.

    I just used the "package" functionnality in build menu : it added the feature to the WSP file.

    silly and solved

     

    • Marked as answer by Zino_o Thursday, December 8, 2011 3:17 PM
    Thursday, December 8, 2011 3:17 PM

All replies

  • Change the scope to WebApplication and then deploy and see
    Wednesday, December 7, 2011 7:16 PM
  • I agree with you. Change the scope from Site to Web Application. And after retracting your solution restart the SharePoint 2010 Timer Service and deploy your package again. After activation of your feature for your specified web application you should see your timer job definition.
    Falco - http://www.msscorner.de
    Wednesday, December 7, 2011 8:52 PM
  • thx for your replies.

    I have changed the scope and reinstalled the WSP in my test environment.

    I still don't see the timer job. And this time, I enabled the job in the method  FeatureActivated() of my SPFeatureReceiver.

     

    Do you know how can I get the logs of the WSP installation ?

    Or other idea ?


    • Edited by Zino_o Thursday, December 8, 2011 1:39 PM
    Thursday, December 8, 2011 10:33 AM
  • Are you sure that you add the timerjob correctly in the Feature EventReceiver? 

    SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
    SPJobDefinition timerJob = null;
    
    timerJob = new TimerJob.MyTimerJob("jobName", webApp);
    
    //set schedule time
    ...
    
    timerJob.Update();
    

     

    This code should be work! Because  i added my timerjob like this way and it works.

    Here you find a good instruction to create a TimerJob also with Site Collection Feature. http://dotnetfinder.wordpress.com/2010/07/24/creatingcustomsharepointtimerjob2010/

    I hope it helps!


    Falco - http://www.msscorner.de




    Thursday, December 8, 2011 11:17 AM
  • Yes I did it like it is described in the blog you mentioned.

    here is the code of activation :

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
    	SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
    
    	// make sure the job isn't already registered	 
    	foreach (SPJobDefinition job in webApp.JobDefinitions)
    	{
    		if (job.Name == JOB_NAME)
    		{
    			job.Delete();
    		}
    	}
    
    	// install the job
    	GetGedDocsJob listLoggerJob = new GetGedDocsJob(JOB_NAME, webApp);
    
    	SPMinuteSchedule schedule = new SPMinuteSchedule();
    
    	schedule.BeginSecond = 0;
    
    	schedule.EndSecond = 59;
    
    	schedule.Interval = 2;
    
    	listLoggerJob.Schedule = schedule;
    
    	//listLoggerJob.IsDisabled = true;
    
    	listLoggerJob.Update();
    }
    


    When I developp, I use the deploy functionnality of Visual Studio : it works great.

    Now, i am trying (with WSPBuilder) to do the packaging of the project for deploying on a test environment.

     

     

     

     

    Thursday, December 8, 2011 11:54 AM
  • I added -WebApplication and my deploy command andd I have this error (but I have set my feature to WebApplication scope) :
    PS C:\> Install-SPSolution -Identity GEDTimerJob.wsp -WebApplication http://XXX-sharepoint -GACDeployment

    Install-SPSolution : This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

     

    :( , I am full newbie in VS 2010 and SharePoint ...

    Thursday, December 8, 2011 12:03 PM
  • The Feature with the Event Receiver and the Timer Job is included into your package?

    Did you restart the SharePoint 2010 Timer Service after retracting your old package? Because this service caches the content of the packages and synchronize them to all server in the farm.


    Falco - http://www.msscorner.de
    Thursday, December 8, 2011 12:37 PM
  • Because the deploy command with -WebApplication doesn't work, Installed once again the WSP with :

     

    Add-SPSolution –LiteralPath "C:\Deployment\MySolutionPackage.wsp"
    
    Install-SPSolution –Identity MySolutionPackage.wsp –GACDeployment
    

     

    Then, I restarted the SharePoint 2010 Timer Serviceby doing this :

    net stop SPTimerV4
    net start SPTimerV4
    

    Then, i ran this command :

    Get-SPSolution GEDTimerJob.wsp
    
    Name                           SolutionId                           Deployed
    ----                           ----------                           --------
    gedtimerjob.wsp                29079cd9-9571-4d82-ad42-88ea9bae8070 True
    
    


    But I still don't see my timer job in Job Definitions ...

     

    Thursday, December 8, 2011 1:38 PM
  • Concerning your question about the package, I opened the WSP with 7zip, there is a DLL file and a manifest file :

     

    <?xml version="1.0"?>
    <!-- Solution created by WSPBuilder. 08/12/2011 11:07:07 * Solution compatibility: SharePoint 2010 -->
    <Solution SolutionId="29079cd9-9571-4d82-ad42-88ea9bae8070" ResetWebServerModeOnUpgrade="Recycle" xmlns="http://schemas.microsoft.com/sharepoint/">
      <Assemblies>
        <Assembly Location="GEDTimerJob.dll" DeploymentTarget="GlobalAssemblyCache" />
      </Assemblies>
    </Solution>
    

     


    In the VS project, I have created the feature :

     

    <Feature xmlns="http://schemas.microsoft.com/sharepoint/" 
    Title="GEDTimerJob Feature" Id="12768171-5559-48c3-9e44-42ad14c3e70b"  
    ReceiverAssembly="GEDTimerJob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3259968249f17ac2"  
    ReceiverClass="GEDTimerJob.Features.ProtoJob.ProtoJobEventReceiver" Scope="WebApplication"><br/><br/></Feature>
    

     

    Should it be in the root of generated WSP ? Or into the DLL file ?

    Thursday, December 8, 2011 2:22 PM
  • OK found the solution. It is silly ...

    I was using the add-in WSP builder for Visual Studio to generate the WSP package but it was missing the feature.

    I just used the "package" functionnality in build menu : it added the feature to the WSP file.

    silly and solved

     

    • Marked as answer by Zino_o Thursday, December 8, 2011 3:17 PM
    Thursday, December 8, 2011 3:17 PM
  • The Feature with the Event Receiver and the Timer Job is included into your package?

    Did you restart the SharePoint 2010 Timer Service after retracting your old package? Because this service caches the content of the packages and synchronize them to all server in the farm.


    Falco - http://www.msscorner.de
    And i ask you whether your Feature etc. is included in the package:D
    Falco - http://www.msscorner.de
    Thursday, December 8, 2011 5:01 PM
  • Sorry for the delay.

    yes, my feature was included in the package only when using the Package function in Visual Studio Build menu.

    But I can't do the same thing with the plugin WSPBuilder ... I have installed this plugin after reading articles on "how to package a solution" but this plugin doesn't do the job in my solution (right click on project, WSPBuilder > Build WSP). Or I don't know how to use it.

    VS2010 packaging works fine.

    Friday, December 30, 2011 6:08 PM