I'm a beginner with java Spring I try to creating simple hello world application when I run it gives me this error here is my error message I tried everything I could.
I've changed url-pattern but it won’t works this happen when I save my files under web-inf folder.

I got an exception with below root cause:

org.springframework.beans.factory.BeanCreationException: error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0'

Type Exception Report

my CONTROLLER

 package com.dare.controller.home;
 import org.springframework.stereotype.Controller; 
 import org.springframework.web.bind.annotation.RequestMapping;

 @Controller public class controller {
   @RequestMapping("/home")
   public String home(){
         return "home";
      } 
 }

MY dispatcher-servlet

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/cache"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
    <context:component-scan base-package="com.dare"/>
    <mvc:annotation-driven />
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">    
        <property name="prefix" value="/WEB-INF/view"/>
        <property name="suffix" value=".jsp"/>
    </bean>
</beans>

WEB.XML file

 <?xml version="1.0" encoding="UTF-8"?>  <web-app
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"          version="3.1">
    <servlet>    
        <servlet-name>dispatcher</servlet-name> 
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>  </web-app>

PROM.XML file

<?xml version="1.0" encoding="UTF-8"?> 
<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">
 <modelVersion>4.0.0</modelVersion>
 <groupId>ill</groupId>
<artifactId>ill</artifactId>
<version>1.0-SNAPSHOT</version> 
 <dependencies>
    <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc  -->
   <dependency>
         <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.6.RELEASE</version>
      </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
     <dependency>
        <groupId>javax.servlet</groupId>
         <artifactId>jstl</artifactId>
         <version>1.2</version>
     </dependency>
     <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-webmvc</artifactId>
         <version>4.3.6.RELEASE</version>
      </dependency>
   </dependencies>
 </project>

VIEW file

   <%--   Created by IntelliJ IDEA.   User: dare   Date: 12/24/2017  
   Time: 1:27 PM   To change this template use File | Settings | File
   Templates.  --%> 
   <%@ page contentType="text/html;charset=UTF-8" language="java" %> 
   <html>   
    <head><title>Title</title> </head> 
    <body> <h1>Hi hello</h1> </body> 
   </html>
1

There are 1 best solutions below

0
On BEST ANSWER

The stack trace indicates that there is no cacheManager. You need to tell spring to initialize cacheManager by adding this to your spring xml configuration.

<cache:annotation-driven/>

See https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cache/annotation/EnableCaching.html for more information.