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)

Error executing code: <object name>object does not have method 'new' in Batch Job

(0) ShareShare
ReportReport
Posted on by 935

Hi,

I have a custom class which extends runbasebatch. The class I created have a new method which will initialize some variables. I have another classes which extends this class. Now, when I manually run the child class, no errors appears and it works as expected. But when I ran it as batch job, an error appears. The error log is: Error executing code: SomeObject object does not have method 'new'.

I tried the solution from this link: http://dynamics-ax-prasankumar.blogspot.co.nz/2012/07/ax2012-error-executing-code-object-does.html   but still no luck.

Any ideas?

*This post is locked for comments

I have the same question (0)
  • dolee Profile Picture
    11,279 on at

    Batch job runs in CIL, have you do a "Generate incremental CIL" or "Genreate Full CIL" before trying to run it as batch job?

  • Freya Tan Profile Picture
    935 on at

    yes i did.

  • dolee Profile Picture
    11,279 on at

    Hmm...try:

    - Compile your custom class and its child classes one by one. (Have seen discussion about an issue that sometimes compilation error are not reported when compile multiple objects)

    - Compile forward from the RunBaseBatch class

    - Generate full CIL (Just to be sure)

    Hopefully that'll do it for you.

  • Suggested answer
    Tommy Skaue Profile Picture
    Microsoft Employee on at

    Batches run as CIL, so compiling CIL is a requirement, as dolee says. :-)

    Just as a sanity check, you could make sure the new method exists in the source-folder located under:

    C:\Program Files\Microsoft Dynamics AX\60\Server\YOUR_INSTANCE\bin\XppIL\

    Search for a file named YourClassName.new.xpp.

    Requires server side breakpoints to be enabled on the AOS though:
      

  • Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at

    I don't know if it's relevant to your case, but you could get into troubles if the constructor doesn't have correct access modifier (public/protected...).

    Let's say you have a private constructor and call it via reflection. AX reflection API ignores access modifiers and will call it without issues. But .NET reflection will use BindingFlags.Public and will fail to find any constructor.

  • Majid Hafeez Profile Picture
    40 on at

    I have faced the same issue and it resolved by running  CIL Incremental Thanks, Dominic Lee

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans