Displaying javax.resource.ResourceException on a faces JSP page

Errors from the IMS resource adapter are returned to a Web application as exceptions of the type javax.resource.ResourceException. For example, if a Web application runs an IMS transaction and the transaction is stopped, a ResourceException subclass IMSDFSMessageException is thrown containing the IMS Connector for Java message ICO0079E. This message contains the DFS065: TRAN/LTERM STOPPED message from IMS.

To display the exceptions that are returned by the IMS resource adapter on the faces JSP generated by Rational Application Developer, you must modify the code of the Web application. To modify the code of the Web application, working with the PhoneBookWeb application, complete the following steps:
  1. In the Project Explorer view of the J2EE perspective, expand Dynamic Web Projects > PhoneBookWeb.
  2. Open PBookF.java in the Java editor.
  3. In the PBookF.java file, locate the doJavaRunPBAction() method and modify the catch block as follows:
     } catch (Exception e) {
                facesContext.addMessage(null,new FacesMessage(e.getLocalizedMessage()));
                logException(e);
            }
  4. An error stating that the "FacesMessage" class cannot be resolved appears. You need to add an import statement in the PBookF.java file.
    1. In the Java editor, place your edit cursor on the FacesMessages class that is in error.
    2. Right-click and select Source > Add Import. The import statement is added to PBookF.java and the project automatically rebuilds. The error should disappear.
  5. Save your changes and close the files.
You can now display the exceptions that are returned by the IMS resource adapter on the faces JSP generated by Rational Application Developer.
Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.