title: Error 404 when trying to access my rest api from post for a jakarta EE project on payara server. Not used javaEE in a very long time
body: <p>Here is my persistence.xml for an embedded h2 database defining the database
  properties</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;persistence version=&quot;1.0&quot; xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot; 
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
  xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/persistence 
  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&quot;&gt;
    &lt;persistence-unit name=&quot;com.apps.io_user_management_war_1.0-SNAPSHOTPU&quot; 
  transaction-type=&quot;RESOURCE_LOCAL&quot;&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
        &lt;property name=&quot;jakarta.persistence.jdbc.driver&quot; value=&quot;org.h2.Driver&quot; /&gt;
        &lt;property name=&quot;jakarta.persistence.jdbc.url&quot; value=&quot;jdbc:h2:target/h2-2&quot; /&gt;
        &lt;property name=&quot;jakarta.persistence.jdbc.user&quot; value=&quot;sa&quot; /&gt;
        &lt;property name=&quot;jakarta.persistence.jdbc.password&quot; value=&quot;&quot; /&gt;
        &lt;property name=&quot;eclipselink.ddl-generation&quot; value=&quot;drop-and-create-tables&quot; /&gt;
        &lt;property name=&quot;eclipselink.ddl-generation.output-mode&quot; value=&quot;database&quot; /&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  <p>My web.xml describing the servlet mappings for the rest api</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
      &lt;web-app xmlns=&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/javaee 
           http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&quot;
           version=&quot;4.0&quot;&gt;
           &lt;session-config&gt;
              &lt;session-timeout&gt;
                  30
              &lt;/session-timeout&gt;
          &lt;/session-config&gt;
          &lt;servlet&gt;
          &lt;servlet-name&gt;default&lt;/servlet-name&gt;
                &lt;servlet-class&gt;org.apache.catalina.servlets.DefaultServlet&lt;/servlet- 
                class&gt;
                &lt;init-param&gt;
                &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
                &lt;param-value&gt;com.apps.io.webservice.ApplicationConfig&lt;/param-value&gt;
                &lt;/init-param&gt;
                &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
          &lt;/servlet&gt;
      
          &lt;servlet-mapping&gt;
              &lt;servlet-name&gt;default&lt;/servlet-name&gt;
              &lt;url-pattern&gt;/rest/api/*&lt;/url-pattern&gt;
          &lt;/servlet-mapping&gt;
        &lt;/web-app&gt;
  </code></pre>
  <p>My Entity class for the User class for CRUD</p>
  <pre><code>    @Entity
      @Table(name = &quot;user&quot;)
      public class User {
      
          @Id
          @GeneratedValue
          private long userId;
      
          @Column
          private String firstName;
      
          @Column
          private String lastName;
      
          @Column
          private String email;
      
          @Column
          private String birthday;
      
          @Column
          private String password;
  
          public long getUserId() {
              return userId;
          }
  
          public void setUserId(long userId) {
              this.userId = userId;
          }
  
          public String getFirstName() {
              return firstName;
          }
  
          public void setFirstName(String firstName) {
              this.firstName = firstName;
          }
  
          public String getLastName() {
              return lastName;
          }
  
          public void setLastName(String lastName) {
              this.lastName = lastName;
          }
  
          public String getEmail() {
              return email;
          }
  
          public void setEmail(String email) {
              this.email = email;
          }
  
          public String getBirthday() {
              return birthday;
          }
  
          public void setBirthday(String birthday) {
              this.birthday = birthday;
          }
  
          public String getPassword() {
              return password;
          }
  
          public void setPassword(String password) {
              this.password = password;
          }
      
      }
  </code></pre>
  <p>My CDI Service to perform the necessary crud functions.</p>
  <pre><code>    @ApplicationScoped
      @Transactional
      public class UserService {
      
          private final EntityManagerFactory emf = 
          Persistence.createEntityManagerFactory(&quot;com.apps.io_user_management_war_1.0- 
          SNAPSHOTPU&quot;);
          private final EntityManager entityManager = emf.createEntityManager();
      
          public List&lt;User&gt; getAllUsers() {
              return entityManager.createQuery(&quot;SELECT c FROM user c&quot;, 
          User.class).getResultList();
          }
      
          public User createUser(User user) {
              entityManager.persist(user);
              return user;
          }
      
          public User getUser(String email) {
              TypedQuery&lt;User&gt; query = entityManager.createQuery(&quot;SELECT e FROM user e 
              WHERE e.email = :email&quot;, User.class);
              query.setParameter(&quot;email&quot;, email);
              return query.getSingleResult();
          }
      
          public User updateUser(User user) {
              entityManager.merge(user);
              return user;
          }
      
      }
  </code></pre>
  <p>My Application Sub Class for the rest api service</p>
  <pre><code>    @ApplicationPath(&quot;rest&quot;)
      public class ApplicationConfig extends Application {
  
          @Override
          public Set&lt;Class&lt;?&gt;&gt; getClasses() {
              Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;();
              addRestResourceClasses(resources);
              return resources;
          }
  
          /**
           * Do not modify addRestResourceClasses() method.
           * It is automatically populated with
           * all resources defined in the project.
           * If required, comment out calling this method in getClasses().
           */
          private void addRestResourceClasses(Set&lt;Class&lt;?&gt;&gt; resources) {
          }
      
      }
  </code></pre>
  <p>The Rest Api class containg all the rest api endpoints.</p>
  <pre><code>    @Path(&quot;api&quot;)
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public class ApiResource {
  
          /**
           * Creates a new instance of ApiResource
           */
           public ApiResource() {
           }
  
           @Inject
           private UserService userService;
      
           @GET
           @Path(&quot;/getAllUsers&quot;)
           public List&lt;User&gt; getAllUsers() {
               return userService.getAllUsers();
           }
      
           @POST`enter code here`
           @Path(&quot;/createUser&quot;)
           public User createUser(User user) {
              return userService.createUser(user);
           }
      
          @POST
          @Path(&quot;/updateUser&quot;)
          public User updateUser(User user) {
              return userService.updateUser(user);
          }
      
          @GET
          @Path(&quot;/getUser&quot;)
          public User getUser(@QueryParam(&quot;email&quot;) String email) {
              return userService.getUser(email);
          }
      }
  </code></pre>