I am trying to deploy the APEX code in salesforce ORG using ANT tool but getting following error:

components/TestComplete.component -- Error: Previous load of class failed: Class.BR02.RelationshipHandler.CreateRelationship: line 160, column 43
    Class.BR02.SendBulkRequests.execute: line 132, column 44
    Class.BR02.SendBulkRequestsHandler.execute: line 32, column 13
    BR02.WUtil: line 955, column 134: Dependent class is invalid and needs recompilation:
    BR02.labutil: line 274, column 68: Dependent class is invalid and needs recompilation:
    BR02.RelUtil: line 527, column 92: Dependent class is invalid and needs recompilation:
    BR02.CreatePostController: line 49, column 28: Public remoted methods not allowed in global components 

I don't understand why it is throwing this error.

There are batch jobs running and in the finish method of that job, we are calling another job like this:

global void finish(Database.BatchableContext BC) {
    Database.executeBatch(new SendBulkRequests(requestListToProcess), 1);
  • 3
    Your issue is in BR02.CreatePostController not the batch job. Look at the stack trace - This explains it salesforce.stackexchange.com/questions/80861/…
    – Eric
    Commented Mar 21, 2017 at 13:06
  • @Eric - Thanks for replying. The batch was different and I just posted the finish method of batch but the compiler was throwing error on different classes which were not modified at all. Commented May 11, 2017 at 5:51

1 Answer 1


I don't know how it works but following is what I did:

In the finish method of job, I removed the second call and handled it somewhere else in the code and first call, I moved it inside the if condition which will call it only if there is something to do...

Following is the new code of the finish method after which the deployment was successful.....

global void finish(Database.BatchableContext BC) {
    if (requestListToProcess.size() > 0) {
        Database.executeBatch(new SendBulkRequests(requestListToProcess ),1);
  • Thanks for closing the loop. I have found sometimes deploying with tooling API has caused a similar issue but same deployment using metadata API does not or vice versa I forget which. Some weird behavior lately
    – Eric
    Commented May 11, 2017 at 6:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .