web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Facing error in batch job

(0) ShareShare
ReportReport
Posted on by 3,801

Hi All,

I am facing error in the batch job which ended in error every time when I try to run it. (see screenshot)

I have tried creating new batch job with the different batch group, run full CIL, compilation e.t.c but the same issue.

This process run without any error if we run it without batch.

Can anyone tell what is the issue?

error-in-batch-job.png

Regards,

Hassan

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Can you provide some more information (like the complete stack trace, standard Ax/custom business process) and to capture the exact error you could introduce CLRError exception handling in your code(if its not present) like below.

    System.Exception ex;

    catch (Exception::CLRError)

       {

           ex = ClrInterop::getLastException();

           if (ex != null)

           {

               ex = ex.get_InnerException();

               if (ex != null)

               {

                   error(strFmt("%1",  ex.ToString()));

               }

           }

       }

    Thanks,

    Chaitanya Golla

  • Hassan_rulz Profile Picture
    3,801 on at

    System.NullReferenceException: Object reference not set to an instance of an object.

      at Dynamics.Ax.Application.EgxProcessAllocationService.Run(EgxProcessAllocationServiceContract _contract) in EgxProcessAllocationService.run.xpp:line 7

      at EgxProcessAllocationService::run(Object , Object[] )

      at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(Object instance, String MethodName, Object[] parameters)

      at Microsoft.Dynamics.Ax.Xpp.DictClass.Callobject(String _methodName, XppObjectBase _Called, Object[] varArgs)

      at Dynamics.Ax.Application.SysOperationServiceController.Runoperation(Boolean _async) in SysOperationServiceController.runOperation.xpp:line 88

      at Dynamics.Ax.Application.SysOperationServiceController.Run() in SysOperationServiceController.run.xpp:line 27

      at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54

      at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13

      at BatchRun::runJobStatic(Object[] )

      at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

      at BatchIL.taskThreadEntry(Object threadArg)

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    As per call stack you are receiving this error at line# 7 of run method in class EgxProcessAllocationService stating object of a certain class is not instantiated and run method is implemented as static. Probably class referenced on line# 7 has runOnProperty set to client.If so, change it to CalledFrom.

    You can debug though visual studio on batch server(when class is executing in batch mode). Refer following link to debug x++ code through visual studio: community.dynamics.com/.../debug-from-visual-studio-x-code-running-on-the-server-ax-2012

    As its a custom code cannot say the exact reason. If error is not resolved, please post the code will try to solve it.

    Thanks,

    Chaitanya Golla

  • Ajit Profile Picture
    8,788 on at

    there could be some casting issue. Are you talking about custom class here?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans