javaspring-mvcgradlespring-dataspring-data-hadoop

Errors while using both Spring Data Hadoop + Spring MVC


I just started with Spring and Hadoop. I had the following build.gradle which worked fine:

dependencies {
    compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
    compile 'jstl:jstl:1.2'
    providedCompile 'javax.servlet:servlet-api:2.5'
}

However, when adding

compile 'org.springframework.data:spring-data-hadoop:2.1.2.RELEASE'

to the dependencies, my app can no longer displayed the JSP... I got the error:

javax.servlet.ServletException: java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

I am using Tomcat 7.0.61, with Eclipse Juno (version 4.2.0).

After some research, I found that I should add dependencies exclusions, but which ones? Because I only have two dependencies (sping mvc and spring data hadoop) but I can't exclude any of them.

I am very new with Gradle too.
Thank you for your help.


Solution

  • I was having dependencies problem with Tomcat. I added on top of my build.gradle file:

    configurations {
        all*.exclude group: 'tomcat', module: 'jasper-runtime'
    }
    

    This solved the problem.