title: spring MVC org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.ArrayList
body: <p>This is the output I get in my Browser for a Spring MVC using REST</p>
  
  <pre><code>org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.ArrayList
  org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:226)
  org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:224)
  org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:119)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  </code></pre>
  
  <p>It is fetching the list from database and also printing in console but for some reason it is unable to convert to JSON</p>
  
  <p>here's my web.xml</p>
  
  <pre><code>&lt;web-app 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_3_1.xsd"
      version="3.1"&gt;
  
      &lt;display-name&gt;Restaurant&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;servlet- 
      class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>here's my dispatcher servlet</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="http://www.springframework.org/schema/p"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans  
  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
  http://www.springframework.org/schema/context  
  http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  &lt;context:component-scan
      base-package="com.mvcrest.controller"&gt;&lt;/context:component-scan&gt;
  &lt;/beans&gt;  
  </code></pre>
  
  <p>I've searched around and most solutions point towards adding jackson dependencies in pom.xml but I already have them</p>
  
  <pre><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/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;MvcRest&lt;/groupId&gt;
      &lt;artifactId&gt;MvcRest&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;4.0.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-core --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;5.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-context --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;5.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;version&gt;5.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;5.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.47&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;2.9.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.9.5&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.7.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.2.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>My controller is also being hit(I know this because the List is being printed in console)</p>
  
  <pre><code>@Controller
  public class App {
      IRestaurantService res;
  
      public App() {
          try {
              res = new RestaurantService();
          } catch (ClassNotFoundException | SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
  
      @RequestMapping(value = "/menu", method = RequestMethod.GET)
      public ResponseEntity&lt;List&lt;Menu&gt;&gt; getmenu() {
          List&lt;Menu&gt; menus = res.getMenu();
          for (Menu menu : menus) {
              System.out.println(menu.getName());
          }
          return new ResponseEntity&lt;List&lt;Menu&gt;&gt;(menus, HttpStatus.OK);
      }   
  }
  </code></pre>
  
  <p>Here's my console log(I use Eclipse Photon for the record).</p>
  
  <pre><code>Nov 12, 2018 5:47:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MvcRest' did not find a matching property.
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server version:        Apache Tomcat/9.0.10
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server built:          Jun 20 2018 17:32:21 UTC
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server number:         9.0.10.0
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Name:               Windows 10
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Version:            10.0
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Architecture:          amd64
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Java Home:             C:\Program Files\Java\jre1.8.0_102
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Version:           1.8.0_102-b14
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Vendor:            Oracle Corporation
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_BASE:         D:\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_HOME:         D:\Tools\apache-tomcat-9.0.10
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.base=D:\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.home=D:\Tools\apache-tomcat-9.0.10
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dwtp.deploy=D:\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Djava.endorsed.dirs=D:\Tools\apache-tomcat-9.0.10\endorsed
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dfile.encoding=Cp1252
  Nov 12, 2018 5:47:34 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_102\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jre1.8.0_102/bin/server;C:/Program Files/Java/jre1.8.0_102/bin;C:/Program Files/Java/jre1.8.0_102/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Application Virtualization Client;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\Maven\bin\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Program Files\Tomcat\bin\;C:\Users\M1048950\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Microsoft VS Code\bin;C:\Users\M1048950\AppData\Roaming\npm;C:\windows\system32;;.]
  Nov 12, 2018 5:47:34 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-nio-8030"]
  Nov 12, 2018 5:47:34 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  Nov 12, 2018 5:47:34 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-nio-8090"]
  Nov 12, 2018 5:47:34 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  Nov 12, 2018 5:47:34 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 1426 ms
  Nov 12, 2018 5:47:34 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service [Catalina]
  Nov 12, 2018 5:47:34 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/9.0.10
  Nov 12, 2018 5:47:44 PM org.apache.jasper.servlet.TldScanner scanJars
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  Nov 12, 2018 5:47:57 PM org.apache.jasper.servlet.TldScanner scanJars
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  Nov 12, 2018 5:47:57 PM org.apache.catalina.core.ApplicationContext log
  INFO: No Spring WebApplicationInitializer types detected on classpath
  Nov 12, 2018 5:47:57 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring FrameworkServlet 'dispatcher'
  Nov 12, 2018 5:47:57 PM org.springframework.web.servlet.FrameworkServlet initServletBean
  INFO: FrameworkServlet 'dispatcher': initialization started
  Nov 12, 2018 5:47:57 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Nov 12 17:47:57 IST 2018]; root of context hierarchy
  Nov 12, 2018 5:47:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
  Nov 12, 2018 5:48:00 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry register
  INFO: Mapped "{[/menu],methods=[GET]}" onto public org.springframework.http.ResponseEntity&lt;java.util.List&lt;com.mvcrest.entity.Menu&gt;&gt; com.mvcrest.controller.App.getmenu()
  Nov 12, 2018 5:48:01 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
  INFO: Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Nov 12 17:47:57 IST 2018]; root of context hierarchy
  Nov 12, 2018 5:48:02 PM org.springframework.web.servlet.FrameworkServlet initServletBean
  INFO: FrameworkServlet 'dispatcher': initialization completed in 4536 ms
  Nov 12, 2018 5:48:02 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-nio-8030"]
  Nov 12, 2018 5:48:02 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-nio-8090"]
  Nov 12, 2018 5:48:02 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 27251 ms
  Nov 12, 2018 5:48:03 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/MvcRest/] in DispatcherServlet with name 'dispatcher'
  
  
  Burger
  Pizza
  Pasta
  Nutella
  Steak
  Ice Cream    
  
  Nov 12, 2018 5:48:08 PM org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleHttpMessageNotWritable
      WARNING: Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.ArrayList
  </code></pre>
  
  <p>I am hitting the endpoint "<a href="http://localhost:8030/MvcRest/menu" rel="nofollow noreferrer">http://localhost:8030/MvcRest/menu</a>" using Browser(Tried Postman too but that shouldn't make a difference and is irrelavent here).</p>
  
  <p>Been at it for 3 Days. Any help is Much Appreciated</p>