+ Start a Discussion
sakthidharan Ambayiramsakthidharan Ambayiram 

method doesnot exist or incorrect signature

Hi all ,
getting the below eeror while excuting batch
Line: 2, Column: 10
Method does not exist or incorrect signature: void executeBatch(CustomerProcessingBatch) from the type Database

Executing the below code in Anonymous window 

CustomerProcessingBatch objectClass=new CustomerProcessingBatch();
Database.executeBatch(objectClass);

ApexClass:
global class CustomerProcessingBatch implements Database.Batchable<sObject>
{
    global String[] email=new string[] {'a.sakthidhn@gmail.com'};
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
       return Database.getQueryLocator('select id,name,Customer_Status__c,Customer_Description__c from Apex_Customer__c where Active__c=true');
    }
    //execute
    global void execute(Database.BatchableContext BC,List <sObject> scope)
    {
        List<Apex_Customer__c> CustomerList=new List<Apex_Customer__c>();
        for(sObject objscope: scope)
        {
            Apex_Customer__c newobjscope=(Apex_Customer__c)objscope;
            newobjscope.Customer_Description__c='Records updated via Batch Job';
            newobjscope.Customer_Status__c='Paid';
            CustomerList.Add(newobjscope);
            system.debug('Records Updated' +CustomerList);
        }
        if(CustomerList!=null && CustomerList.size()>0)
        {
            Database.update(CustomerList);
            system.debug('Records Updated'+CustomerList);
        }
     }
    global void finish(Database.BatchableContext BC)
    {
        Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
        AsyncApexjob a= [select a.Totaljobitems, a.Status,a.NumberOfErrors,a.JobType,a.JobItemsProcessed,a.ExtendedStatus,a.CreatedById,a.CompletedDate from AsyncApexJob a where id= :BC.getJobId()];
        system.debug('JobId'+BC.getJobId());
        mail.SetToAddresses(email);        
        mail.SetReplyTo('a.sakthidhn@gmail.com');
        mail.SetSenderDisplayName('Apex Batch Processing Module');
        mail.setSubject('Batch Status' +a.Status);
        mail.setPlainTextBody('The Batch Apex Job Processed'+a.TotalJobItems+'Batches with'+a.NumberOfErrors+'Failures'+'Job Proceesed are'+a.JobItemsProcessed);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
     }
}
Raj VakatiRaj Vakati
Its looks good for me .. do  you have any extra code in your class CustomerProcessingBatch  ..???

but try this once
 
CustomerProcessingBatch objectClass=new CustomerProcessingBatch();
Database.executeBatch(objectClass,200);

 
sakthidharan Ambayiramsakthidharan Ambayiram
Thanks for your response 

No, this is the only code i had in CustomerProcessingBatch
I tried with your code also, still facing the same issue

 
Raj VakatiRaj Vakati


DO you have any custom apex class with name "Database" .. that mightbe be causing the causing the issue . .. salesforce may not able to recoginize the differnece bwteen your apex class vs database namespace .. 


Check and see if you have any apex class name Database  if so either rename or delete the Database class