Java EE Starter Project (Java 7 JAX-RS EJB)

Contents

1
(2)

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:

JAVA_HOME environment variable on windows

I also added maven bin to path:

Java EE Starter Project (Java 7 JAX-RS EJB) 1

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:

Java EE Starter Project (Java 7 JAX-RS EJB) 2

As you can see, the debug process is listening on port 5005.

Then, create a debugging profile like this:

Create JVM debugging profile

By default, the debugging port is 5005. My IDE (IntelliJ) is smart enough to guess the port and all left is clicking on OK:

Create debug options for JAX-RS app

Then you can click on the Bug icon to start debugging:

Start debugging on JAX-RS EJB application

Conclusion

With this starter project, I hope you can start working on Java EE concepts that are new to you (for example, interceptors, JPA…).

Click on a star to rate it!

Average rating 1 / 5. Vote count: 2

No votes so far! Be the first to rate this post.


Leave a Reply

Your email address will not be published. Required fields are marked *