Christoph Knabe, 2022-05-06
The Central Exception Reporting Sample Application.
- Demonstrates how to use Central Exception Reporting with various interface frameworks.
- It was the companion material to a german article about Central Exception Reporting in the JavaMagazin 11.07 pages 23-27.
- It's a little CRUD application for managing clients. You can create, edit, list, and delete clients.
- You can run it in 5 variants: {Struts|Swing} * {Java|AspectJ} + JavaFX*Java
What platform does this application now run on?
- JDK 8, and
- Maven 3
In the Maven POMs it is configured to use
- Java 8, or AspectJ 8 respectively
- Jetty 9 (Servlet 3.0 container)
- Struts 1.3.10
- MulTEx 8.4 (an exception message text framework)
The file pom.xml manages the Struts, Swing, and JavaFX application using simple Java,
and framework specific mechanisms or the Template Method Pattern for Centralized Exception Reporting.
The file aspect-pom.xml manages the Struts and Swing application using AspectJ
and comfortable aspect-oriented mechanisms for Centralized Exception Reporting.
For all examples is assumed that your default JDK is JDK 8 with JavaFX included. If that is not the case, see below section Troubleshooting.
- type
mvn clean jetty:runat the command prompt for the web app using Struts specific ExceptionHandler. - Browse http://localhost:8080/
- Click on "Create a Client"
- Type in and Save some clients, they will be stored in file
Persistence.serin the working directory - Observe exception messages after data errors (e.g. empty birth date, birth date with some period characters)
- You can see the stack trace of an error message by clicking on the link "Details".
- Click button List to see the entered clients.
- Provoke a low-level exception by making the file
Persistence.serread-only and trying to Save a client. You will see the presentation of an exception chain. - Stop the web app by typing <Ctrl/C> in the command window.
- type
mvn clean integration-testat the command prompt for the Swing app using Template Method Pattern. - This uses the file
pom.xmland the main classswing_ui.ClientSwingApplication. - A GUI will appear, where you can do the same things as above.
- You can see the stack trace of an error message by clicking on the button "Show Stack Trace".
- Stop the application by closing all windows of it.
- Type
mvn clean integration-test -Pfxat the command prompt for the JavaFX app using Template Method Pattern. - This uses the file
pom.xmland the main classfx_ui.ClientFxApplication. - A GUI will appear, where you can do the same things as above.
- You can see the stack trace of an error message by clicking on the button "Details".
- Stop the application by closing all windows of it.
- Type
mvn -f aspect-pom.xml clean jetty:runat the command prompt for the web app using AspectJ for exception reporting. - In the stack traces you can see, that exceptions are caught by an around advice.
- type
mvn -f aspect-pom.xml clean integration-testat the command prompt for the Swing app using AspectJ for exception reporting. - In the stack traces you can see, that exceptions are caught by an around advice.
Where are the Message Resources?
- In the file
MessageResources.properties. The original, which you may edit, is undersrc/main/resources/
Why did the changes to my MessageResources.properties or other resource file disappear?
Why didn't the changes to my MessageResources.properties or other resource file appear?
- The original resource files are under
src/main/resources/and copied totarget/classes/during a build. Change the content ofsrc/main/resources/MessageResources.propertiesand rebuild before running it again. The exception message texts extracted from the JavaDoc comments of all exceptions undersrc/main/java/are collected during theprocess-classesphase by theExceptionMessagesDocletas configured for themaven-javadoc-plugin.
Where is the article?
It is in subdirectory doc in various formats.
Most distributions of JDK 8 on Linux do not contain JavaFX.
If you have that problem, you should get the Liberica JDK 8 by https://sdkman.io/
Then you should either use it as default or prefix the Maven command by ./javafx8.sh as in the following example:
./javafx8.sh mvn clean integration-test
For that you have to update the JDK version number in this script jdkVersion=8.0.332.fx-librca to your currently installed version.
If you have that problem, you should use the Maven Wrapper,
which is delivered with this project. Then you should call it e.g.
./mvnw clean integration-test
If you want to additionally enforce the specific JavaFX JDK you can combine both modifications:
./javafx8.sh ./mvnw clean integration-test
That you can do with all Maven calls shown in this README.
- Originally stored at http://excrep.berlios.de/ by CVS
- From 2017-11-06 at https://app.assembla.com/spaces/excrep/git/source
- From 2022-05-04 at https://github.com/christophknabe/excrep/