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

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics 365 Wonders / Unable to construct an obje...

Unable to construct an object from the class in the batch framework -

Eduardo Arias Profile Picture Eduardo Arias 905

 

Hi There!

I hope your week is going ok and with lots of challenges.

As we all know, when we want to run a custom class in the server as a batch job we need to extend the RunBaseBatch class and schedule a job for it.

Today I was working on a class that needed to be run in the server in AX 2012. However, before I scheduled the process, I made the choice to test my class from the client to make sure I did not have any bugs. When the test was successful, I scheduled the job and waited for the batch job status to go from Waiting to Ended, and to my surprise I got an error.

I wasn't sure if I did have another bug in my class that I did not catch, so I just copied the sample batch class Microsoft has here and schedule another job to see if the problem indeed in my code. I got the same error:

"Unable to construct an object from the class Sample Class in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters"

Looking at some documentation, I read that in some cases we need to generate a full CIL compile, but this takes forever. Then a good friend of mine mentioned that a an Incremental CIL will most likely fix the error, an it did.

So, just to be thorough I would like to show the steps on how to do this:

Open a new development environment and click Build and then choose Generate Incremental CIL.



It is going to take about 2-3 minutes (it depends from environment to environment).



Then, to double check if the job run well, go to System Administration > Inquiries > Batch Jobs and look for your job. It status should now be Ended.



That's all for now folks. Until the next time.


 

This was originally posted here.

Comments

*This post is locked for comments