MBOs in Automation Scripts: Exception Handling
In our previous posts in this series, we talked about how an MboSet is a collection of Mbo objects. In this article, we’ll analyze the different types of exceptions that can be thrown and how each can be utilized. Most methods that can be called through the Business Components can throw either a RemoteException and/or an MXException. A RemoteException is thrown by the Java RMI system when an error occurs during remote communication. The exact nature of the error may be determined by checking the Exception object’s class – which may be one of seventeen subclasses of RemoteException. For more details of these exceptions, refer to the documentation in the Java Development Kit. The MXException is similar to the RemoteException in that the MXException is a super class for all related exceptions. The actual exceptions thrown will be instances of one of the following subclasses:
- This is usually a fatal error from which the client cannot recover. It is usually a problem with either the server configuration or the database configuration. Examples of errors causing this exception are “Out of Memory on Server” or a SQL error. Two subclasses of this class have also been introduced:
- Thrown when a client or server asks for a Mbo that is not known to the system. This is a fatal error that normally points to a bug in the system or an incorrectly configured data dictionary.
- Thrown when the server, which should have an object running, does not respond. This is usually caused by an incorrect configuration of the remote configuration file or indicates that the server running the object is unavailable for some reason.
- This is thrown as a result of any of the many possible application-level errors, most of which are not fatal. Such exceptions should be caught by the client and rectified by the logic of the calling program. Examples of reasons why this exception might be thrown are:
- Trying to set the value of a date attribute to the characters “ABC”.
- Trying to set the “eqnum” attribute in a WO object to an invalid equipment number.
- Thrown when an attempt is made to set an attribute that is read only or access a method that is currently not available. Methods may be unavailable because of security restrictions or because the object is not currently in the correct state.
MXSession s = MXSession.getSession();
// Display any problems with the connect to the user.
System.out.println(“Connecting to (” + s.getHost() + “/”+ s.getServer() + “)” );
String group = ma.getErrorGroup();
String key = ma.getErrorKey();
System.out.println(“Group : ” + group + “ Key : ” + key + “ Message :” + ma.getMessage());
As an IBM Maximo mobile solution provider, A3J Group consistently improves the functionality and features...
Pretend you are going to take a real vacation, two weeks in Spain with no work laptop. You have planned...
A3J Group is happy to announce the latest MxMobile releases below. The releases will be available on...
No comment yet, add your voice below!