RESTful service with TomEE and IntelliJ IDEA

In this tutorial you’ll build a basic RESTful service using the Java EE APIs, IntelliJ IDEA, and TomEE.


  1. Setup the TomEE application server in IntelliJ.
  2. Create a new project.
  3. Write a RESTful Java class.
  4. Run.

Used in This Tutorial


  • Download and install IntelliJ.
  • Download and unpack TomEE.


  1. Setup the TomEE application server in IntelliJ.
    1. Start IntelliJ, and on the startup screen go to Configure -> Settings -> Application Servers.Screen Shot 2013-06-04 at 1.54.26 PM
    2. Click the “+” button (top center) to add an application server.
    3. Select “TomEE” for the type of server.Screen Shot 2013-06-04 at 1.55.41 PM
    4. Enter the directory where you unpacked TomEE.Screen Shot 2013-06-04 at 1.56.55 PM
    5. Click “Ok” and “Ok” again.  Then click the little back button in the start up screen to go back to the main menu.
  2. Create a new project.
    1. Select “Create New Project” in the IntelliJ startup screen.
    2. Select “Java Module”
    3. Name it “MyFirstRESTfulService”.
    4. There’s an option here to select your JDK. You may need to configure your JDK, first. This is an IntelliJ requirement, and I don’t remember how I did this, I hope it’s straight forward enough for you.
    5. Click “Next”.
    6. Select “Application Server” then select “TomEE” from the drop down box on the right.Screen Shot 2013-06-04 at 2.00.42 PM
    7. Select “RESTful service” and “Set up library later”.
    8. Click “Finish”.
  3. Write a RESTful Java class.
    1. Double click the project name to expand the tree view and you will see the “src” directory.
    2. Right click “src” and create a package (select New -> Package) called “org.mybiz”.
    3. Right click “org.mybiz” and create a class (select New -> Java Class) called “Greeter”.
    4. Edit the Greeter class until it reads like this:
      package org.mybiz;
      public class Greeter {
          public String sayHi() {
              return "Hi!!";
  4. Run. Click the green play button to run the RESTful service. You should see messages in an output window at the bottom of IntelliJ. Look for a line like
    INFO: REST Service: http://localhost:8080/greeting/*  -> Pojo org.mybiz.Greeter

    This indicates the service was successfully deployed at the URL specified. Check for exceptions in case something failed.Screen Shot 2013-06-04 at 2.10.15 PM

Point your browser to the correct URL: http://localhost:8080/greeting/, and it works, yay!Screen Shot 2013-06-04 at 2.11.00 PM

One thought on “RESTful service with TomEE and IntelliJ IDEA

  1. Thanks for writing this. I just went through the same process you did about a week earlier, in going to the TomEE docs and reading that TomEE/IntelliJ is awesome … end of page.

    I too managed to get my JAX-RS working. Now I’m trying to port EJB, JPA, Hibernate, JMS, etc. etc. from JBoss. It’s quite the undertaking.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>