title: how to debug REST in IntelliJ with TomEE?
body: <p>I am very new with IntelliJ and Java. </p>
  
  <p>My service is very simple: </p>
  
  <pre><code>@Path("loyaltyMembers")
  @ApplicationScoped
  @Consumes(APPLICATION_XML)
  @Produces(APPLICATION_XML)
  public class LoyaltyService {
      @POST
      @Path("status")
      public MemberStatusResp queryMemberStatus(MemberCard card) {
          MemberProfileResp retval = new MemberProfileResp();
          retval.setMemberName(new MemberName("michael","jackson"));
          return retval;
      }
  
      @POST
      @Path("profile")
      public MemberProfileResp queryMemberProfile(MemberCard card) {
          return null;
      }
  
      @GET
      @Path("getHistory")
      public String getPointHistory() {
          return "hello";
      }
  }
  </code></pre>
  
  <p>the project is setup using Maven and TomEE. 
  I can compile properly and run the goal TomEE:run. </p>
  
  <p><a href="https://i.stack.imgur.com/fP0Gw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fP0Gw.png" alt="using TomEE:run to start the service"></a></p>
  
  <p>I can hit my endpoint getHistory properly and receive the response. </p>
  
  <p>But when I try to Post to the status endpoint, it fails. </p>
  
  <p>My question is, how can I enter the debug mode of IntelliJ? </p>
  
  <p>I used the [Run]->[Edit Configurations] to create a Remote setting, it is like this:</p>
  
  <p><a href="https://i.stack.imgur.com/m2MkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m2MkA.png" alt="Remote Run Configuration"></a></p>
  
  <p>but if I hit the debug mode using this configuration, I kept getting 
  "Unable to open debugger port (localhost:8080)" </p>
  
  <p>Does anyone know how to properly debug? 
  Thanks </p>