Here are several ways to handle errors in Infor M3 Enterprise Collaborator (MEC).
(Disclaimer: I have not been to a MEC training, so these are my own findings, not necessarily the official Infor recommendation.)
1. Message detail page
By default, errors in MEC are reported in MEC Management Pages > Message > Status > State; we can drill down to see the MessageDetailPage with the manifest, the input/output files of each process, and the status:
We can also go directly to the file system and get the manifest, and the input/output files of each process:
This is sufficient for MEC administrators to troubleshoot.
But only users with the app-admin or grid-admin roles have access to this, and this is unannounced, so nobody will know there was an error unless somebody looks.
The MessageDetailPage has buttons Retry to rerun from last failed process, and buttons Redetect to rerun from message detection:
If it helps, the MEC Fundamentals workbook says: “If an error occurs in an XMLTransform step, and Retry is selected, the Process starts with re-sending the input to the XMLTransform step. Meaning that the mapping is executed from the beginning.”
3. Event logs
MEC also shows detailed event logs at MEC Management Pages > Event > Log; it uses the Apache Log4J logger with levels DEBUG|INFO|WARN|ERROR|FATAL; it has a search form to search by UUID, class, text, time, etc.; the loggers are configurable via the web form or via the log.config file; and the logs are persisted in the MecLog table of the MEC database:
This shows many more details than the message detail page, most interestingly the DEBUG|TRACE levels, and the Java stack trace.
4. Error reports
We can drill down the MessageDetailPage to see the HTML error report; it contains the Java stack trace:
We can also get the error reports directly from the file system:
We can also generate a zipped error report package, e.g. to send to Infor Support:
We can change the DocErrorHandler properties to change the XSLT that renders the report, or to change the error report to text format:
We can configure the ErrorMail properties in MEC to automatically send the error reports to a comma separated list of email addresses; the input file (.rcv) is zipped as an attachment:
This is good to automatically notify administrators in case of errors, and it is great for deputies that don’t have the administrative privileges.
But the recipients risk receiving too many emails and becoming desensitized, resulting in the opposite intention.
6. Agreement Email
We can also set a comma separated list of email addresses in the agreement’s Basic tab, and MEC will send the error reports there instead:
This is good to delegate administration to the respective deputies of each agreement, instead of spamming the MEC administrators.
If our mapping calls an M3 API and the API responds with an error, or if our mapping throws an exception, by default the mapping will stop and will call sendMail() to bubble up to the error report.
We can change this default behavior with the ErrorHandling property:
• Exit map on M3 NOK • Exit loop on M3 NOK • Ignore M3 NOK
And we can add a Java function that calls the methods isLastAPICallOK(), hasNOKOccurred(), and getLastAPIMessage() of class com.intentia.ec.mapper.Mapping:
We can also throw an exception with throw new MeCError(“CRASH!”):
All this to attempt recovering from errors, and to do our own error handling.
One of the MEC Development workbook exercises has the opinion that: “all API calls should have their ErrorHandling property set to “Ignore M3 NOK”to prevent the map from failing, and use method hasNOKOcurred() to determine if any API has returned NOK.”
Note: Sometimes it is desirable to produce a specific error output. However, mappings are unable to produce an output other than the XML schema they were designed for, i.e. there is no secondary schema we can output in case of error. The workaround is to do the error handling offline, e.g. build a custom error report and send it in a custom email.
I can summarize it like this:
// default if (OK) use output schema else send error report // desired, but not possible if (OK) use output schema else use error schema // workaround if (OK) use output schema else do custom error handling
We can analyze the generated mapping source to have a better understanding:
8. Error handling tab
We can use the agreement’s Error Handling tab to handle the error with one or more of these processes:
- Apply Envelope
- Create ConfirmBOD
- Outbound MBM Status
- Retrieve MBM Identifier
- XML Transform
- XSL Transform
According to class ErrorTab, these processes are stored in table PR_Process with Standard=0, which gives us their class name:
We can analyze the corresponding Java classes to understand what they do; they seem to made for peculiar requirements.
I created my own processes as illustrated in a previous post, and it works great:
In the DocErrorHandler properties, there are some AdminException regex properties such that if an exception matches the regex, the DocErrorHandler will send the error report to both the email addresses set in the ErrorMail, and the email addresses set in the agreement. To be tested.
We can learn more about error handling in MEC by diving into ec-core-22.214.171.124.0.jar:
There are several ways to handle errors in MEC:
- Use the default message detail page, event logs, and error reports for the administrators to troubleshoot in detail, and eventually retry/re-detect
- Set the ErrorMail and agreement email to automatically notify the deputies and delegate administration
- Write custom Java code in the mappings to attempt recovering from errors and to do our own error handling
- Develop our own error handling processes to have more control
Thanks for reading. If you liked this, please consider subscribing, give a like, leave a comment, share around you, and help us write the next post.
10 thoughts on “Error handling in MEC”
This is a great post because it documents all the Mec error option in one place. I knew most of this but i have to admit my knowledge on the error tab it pat wasnt as robust as i would like.
Do you think you could do an article on troubleshooting techniques for Mec? That article would be a good article to do along with this one. Just a couple thoughts, get the values of variables in the output of a mec message so you can check values at certain points in the transformation. How to use escape points… etc
Thank you. Getting values of variables in the output is trivial. I don’t know what’s escape points. You can already troubleshoot in detail if you just set the required logger levels to DEBUG and possibly TRACE. A packet analyzer (Wireshark/tcpdump) is a must-have for troubleshooting I/O. Beyond that, I would debug at runtime with https://m3ideas.org/2014/10/22/java-debugging-an-infor-grid-application-at-runtime/
UPDATE: You can search your agreement’s log by UUID if you do log.debug(manifest.getUUID() + “[:]Hello, World!”);
LikeLiked by 1 person
thibaudatwork: is there an easy way to remove the zip file from from the error mail?
Hi Robert. Check the MEC properties in the Grid Management Pages; I don’t remember if there is a property mailAttachment true/false or something. (I’m not at my computer right now.)
Robert. I just checked the screenshot of chapter 5. ErrorMail above. Try setting the ErrorMail.Type=text/plain or set the ErrorMail.Attachment.MaxSize=0, maybe that will remove the attachment; to be tested.
Can we access input file inside MEC mapper . my requirement is if MEC input file has a error , I need to move it error location else need to move another folder .
if you have any idea , please let me know .
Hi Priyantha. I don’t work with MEC Mapper so I don’t know. My understanding is that MEC will automatically move the file to an error folder if there is an error during processing. I think you can choose to which error folder it will be moved to, but I think it’s a global setting, not per agreement. And I don’t know if it’s possible to control more than that. Ask on Infor Xtreme.
UPDATE: At my customer I had to disable the global error emails with ErrorMail.Enabled=0 in the Grid Management pages (see chapter 5 above) because one time over a week-end the server went down and sent me an email every minute during the entire week-end until I arrived Monday morning. My mailbox had thousands of emails and my hard-drive was filled with gigabytes of emails and ran out of space. It took a certain effort to clean-up the mess. Disabled! Now I just enable the email per agreement (see chapter 6 above).