Contents
When learning JavaEE the first time, it’s hard to find a project that you can click the triangle and see the code run like in Java SE. I’ve been finding projects like that and after countless hours, I’ve found one from Okta.
With some modifications, I could get it up and running and also configure debug options for the application.
You can clone the application here:
https://github.com/datmt/javaee-ejb-starter
How to run the application
Running this JAX-RS application is super easy. The first thing is to make sure you have maven and JDK installed. Next, make sure you add maven bin folder to path and create environment variable for JDK home as JAVA_HOME.
Here is what it’s like on my Windows machine:
I also added maven bin to path:
After that, you can simply run the following command in the project’s root:
mvn clean package tomee:run
How to debug the application
Debugging the application is also quite simple. First, stop the application if it’s running. Then run the following command in the project’s root:
mvn clean package tomee:debug
The console should output something like this:
As you can see, the debug process is listening on port 5005.
Then, create a debugging profile like this:
By default, the debugging port is 5005. My IDE (IntelliJ) is smart enough to guess the port and all left is clicking on OK:
Then you can click on the Bug icon to start debugging:
Conclusion
With this starter project, I hope you can start working on Java EE concepts that are new to you (for example, interceptors, JPA…).