4

I am deploying to production using the Ant migration tool. Every class is reporting the error: Apex class has Batchable or Future jobs pending or in progress Even classes such as StringUtils and such which have not future or batchable methods.

Someone asked a similar question here Deployment error: Apex class has Batchable or Future jobs pending or in progress; Schedulable class has jobs pending or in progress but it was closed for comment because it was a duplicate of this post: Ghost Schedulable Classes Blocking Deployment

But that post does not answer my problem. Nor does the SF posted help here: https://help.salesforce.com/HTViewSolution?id=000187051&language=en_US

  • The time I had the exact problem you're facing, but in Eclipse, I ended up solving it by deleting the project and redownloading it again. Guess it was all Eclipse's fault. Don't know really how to solve this for Ant, however. Sorry! – André Medeiros Jan 7 '14 at 21:42
  • Have you contacted Salesforce support as suggested in the question you linked to? – Tim Smith Jan 7 '14 at 21:59
  • Is StringUtils ultimately called by another Apex Batchable or Future class? This dependency could explain why you still get the error with a seemingly unrelated class. – Daniel Ballinger Jan 7 '14 at 21:59
6
  1. go to Setup > Administration > Monitoring > Apex Jobs and abort all pending jobs

  2. go to Setup > App > Develop > Apex Classes and hit Compile all classes

  3. re-run your ant deploy target

Any luck?

  • 1
    I should have made it clear that there was no running jobs of any kind, that I could see. I ran the query below to find active jobs and the result was empty list. SELECT ApexClassId,CreatedDate,ExtendedStatus,Id,JobItemsProcessed,JobType,MethodName,NumberOfErrors,ParentJobId,Status,TotalJobItems FROM AsyncApexJob WHERE status!='Completed' AND status!='Aborted' AND status != 'Failed' – Bryan Jan 7 '14 at 22:08
  • @bigassforce How do you delete apex jobs? I don't see any "Delete" buttons or anything like that. – Jorjani Nov 15 '17 at 15:46
3

Suddenly the problem went away.

I suspect that ONE job was active even though I could not see any via this query: SELECT ApexClassId,CreatedDate,ExtendedStatus,Id,JobItemsProcessed,JobType,MethodName,NumberOfErrors,ParentJobId,Status,TotalJobItems FROM AsyncApexJob WHERE status!='Completed' AND status!='Aborted' AND status != 'Failed' As suggested in this SF solution https://help.salesforce.com/HTViewSolution?id=000187051&language=en_US

I suspect this running job blocked all classes and produced misleading error messages. After all StringUtils and 90% of the classes had no future methods nor are they batchable classes.

In any case, the problem went away without any action on my part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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