title: Maven + Jersey RESTful API : Internal Server Error from POSTMAN on GET request
body: <p>I am sending a GET request to my <code>StoryBoardResource</code>, class responsible for generating <code>JSON</code> format data, using POSTMAN app. The associated method consumes nothing but produces <code>Application/JSON</code> data: <code>@Produces(MediaType.APPLICATION_JSON)</code>.</p>
  
  <p>I am recieving <strong>500 internal server error</strong> on POSTMAN though there is nothing showing up on my IDE's console as am logging some statements too for debugging purpose.</p>
  
  <p>If there had been some <strong>jar</strong> file issue it must have thrown an error for <code>no MesageBodyWriter found</code> ...right? I have updated <strong>pom.xml</strong> to include <code>JSON</code> dependency and the jar is also there.</p>
  
  <p>Here is my <code>StoryBoardResource</code> class to which the request is delegated:</p>
  
  <pre><code>import javax.ws.rs.Consumes;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.QueryParam;
  import javax.ws.rs.core.MediaType;
  import org.harsh.webapp.storyBoard.model.StoryBoardModel;
  import org.harsh.webapp.storyBoard.service.StoryBoardService;
  
  @Path("/authenticateUser")
  public class StoryBoardResource {
  
  private StoryBoardService sts = new StoryBoardService();
  
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public StoryBoardModel authUser(@QueryParam("username") String username, @QueryParam("password") String password){
      return sts.authUser(username, password);
  }
  }
  </code></pre>
  
  <p>which calls <code>authUser</code> method on my service class <code>StoryBoardService</code> :</p>
  
  <pre><code>public StoryBoardModel authUser(String username, String password){
      System.out.println("In here");
      if(username.equals(map.get(username).getUsername()) &amp;&amp; password.equals(map.get(username).getPassword())){
          System.out.println("true");
          return map.get(username);
      }
      return map.get(username);
  }
  </code></pre>
  
  <p>Could this be bcoz of some <strong>jar or Jersey version conflict</strong>? 
  Here is my <code>pom.xml</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.harsh.webapp&lt;/groupId&gt;
      &lt;artifactId&gt;storyBoard&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;storyBoard&lt;/name&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;storyBoard&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5.1&lt;/version&gt;
                  &lt;inherited&gt;true&lt;/inherited&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
                  &lt;version&gt;${jersey.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
              &lt;!-- use the following artifactId if you don't need servlet 2.x compatibility --&gt;
              &lt;!-- artifactId&gt;jersey-container-servlet&lt;/artifactId --&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;properties&gt;
          &lt;jersey.version&gt;2.16&lt;/jersey.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  &lt;/project&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is a snapshot of <strong>Maven Dependencies</strong></p>
  
  <p><a href="https://i.stack.imgur.com/USIpw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/USIpw.png" alt="Maven Dependency jars"></a></p>
  
  <p>Sorry for such a long post but I thought I should explain things clearly.
  Please help on finding what could I be doing wrong here?</p>
  
  <p>And <code>web.xml</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- This web.xml file is not required when using Servlet 3.0 container,
       see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html --&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
              &lt;param-value&gt;org.harsh.webapp.storyBoard&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;Jersey Web Application&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/webapi/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;</code></pre>
  </div>
  </div>
  </p>