Tuesday, December 8, 2009

SharePoint Solution: Removed solutions which have failed

Sometimes you may find that solutions have generated error during retraction . This may happen if the “Windows SharePoint Services Administration” service doesn’t run when you run the retract command with stsadm the retraction will fail. So when you visit the solution details page you will find that the deployment status is error and there’s no other operation to perform on the solution except “Back to Solutions” link.


Figure 1: Solution Failed to retract

Now you may consider that if you start the administration service then it’ll work. But it will not. So how will you change the solution status from error to some valid state? If you try the retract the solution from command line or delete the solution then you’ll find exception. Few points to remember before heading on how to fix this:

1. Remember the retraction will work only on deployed solution. Since the solution is not in deployed state so the retraction will not work.

2. You can’t delete the solution as an retraction process in progress.

3. Retraction of a solution is internally a deployment operation.



The first thing you need to do is to cancel the retraction operation. You can’t do it from sharepoitn central administration site. You need to do it from stsadm command line. First find all the solution in deployment state (as said before, retraction is also a kind of deployment). To find all the solutions in deployment state run the following command:

stsadm –o enumdeployments

This will show you all the solutions in deployment state. The output will be something like below

<Deployments Count="1">
   <Deployment JobId="5d0feb9a-4ca6-4e16-9fc0-8839960972f2">
      <Title>Windows SharePoint Services Solution Retraction for "deploymentpackage.wsp"</Title>
      <ServerType>Front-end Web server</ServerType>

In the above output notice the jobid. This is the key we need to go with the solution. A job is created for retracting the solution and we have found the job id. All we need to do now to remove job. You can run the following stsadm command to remove a job for deployment/retraction.

stsadm -o canceldeployment -id 5d0feb9a-4ca6-4e16-9fc0-8839960972f2

When you run the command the deployment (retraction actually) will be canceled and if you run the enumdeployments again you’ll find that the deployment is canceled.Now if you go back to the central admin site you’ll find that the solution is in deployment status. Now before performing any other operation on the solution you need to start the “Windows SharePoint Services Administration” service either you’ll get the solution in error state again.

1 comment:

  1. Thanks very much for your post. I was able to use it to remove the error I was encountering. I did, however, find after I canceled deployment that I continued to get the error whenever I tried to perform the retraction using Central Administration, even after ensuring the Windows SharePoint Services Administrator service was running. I ended up having to use the ststadm command to retract, too.


Note: Only a member of this blog may post a comment.