Why batch jobs working on one server but not on other one?

I have same code on two servers.

I have job for adding batch job to the queue

static void Job_ScheduleBatch2(Args _args)

{

BatchHeader batHeader;

BatchInfo batInfo;

RunBaseBatch rbbTask;

str sParmCaption = “My Demonstration (b351) 2014-22-09T04:09”;

SysRecurrenceData sysRecurrenceData = SysRecurrence::defaultRecurrence();

;

sysRecurrenceData = SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData, DateTimeUtil::utcNow());

sysRecurrenceData = SysRecurrence::setRecurrenceUnit(sysRecurrenceData, SysRecurrenceUnit::Minute,1);

rbbTask = new Batch4DemoClass();

batInfo = rbbTask .batchInfo();

batInfo .parmCaption(sParmCaption);

batInfo .parmGroupId(""); // The “Empty batch group”.

batHeader = BatchHeader ::construct();

batHeader .addTask(rbbTask);

batHeader.parmRecurrenceData(sysRecurrenceData);

//batHeader.parmAlerts(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);

batHeader.addUserAlerts(curUserId(),NoYes::No,NoYes::No,NoYes::No,NoYes::Yes,NoYes::No);

batHeader .save();

info(strFmt("’%1’ batch has been scheduled.", sParmCaption));

}

and I have a batch job

class Batch4DemoClass extends RunBaseBatch

{

int methodVariable1;

int metodVariable2;

#define.CurrentVersion(1)

#localmacro.CurrentList

methodVariable1,

metodVariable2

endmacro

}

public container pack()

{

return [#CurrentVersion,#CurrentList];

}

public void run()

{

// The purpose of your job.

info(strFmt(“epeating batch job Hello from Batch4DemoClass .run at %1”

,DateTimeUtil ::toStr(

DateTimeUtil ::utcNow())

));

}

public boolean unpack(container _packedClass)

{

Version version = RunBase::getVersion(_packedClass);

switch (version)

{

case #CurrentVersion:

[version,#CurrentList] = _packedClass;

break;

default:

return false;

}

return true;

}

On one server it do runs and in batch history I can see it is saving messages to the batch log and on the other server it does nothing. One server is R2 (running) and R3 (not running).

Both codes are translated to CIL. Both servers are Batch server. I can see the batch jobs in USMF/System administration/Area page inquries. Only difference I can find is that jobs on R2 has filled AOS instance name in genereal and in R3 it is empty. In R2 I can see that info messages in log and batch history but there is nothing in R3.

Any idea how to make batch jobs running?
AX 2012 R2 and R3

Could you give us more information? In R3, does the problem applies to all batches, only to your Batch4DemoClass only, only to batches added by Job_ScheduleBatch2 or how else does it behave?

I think I’ve seen a problem related to AOS instance name, I believe it was about batches scheduled on different AOS before the database was moved to another AX instance.

Dear, Make sure that your AOS name is select on the batch group.

It looks like only the “new” batch has problem. The new created batch in Batch table has “” value in serverId column. But in server settings and batch group settings there is right serverId (batch servers selected server).

I am afraid I will have similar problem as https://community.dynamics.com/ax/f/33/t/115607.aspx had.

did you try the solution in the link that you shared above?

Not yet. Server is not under my jurisdiction so I am waiting for approval of my colleagues.