Home  >  Forum  >  Web Server
Post New Query

(Ljavax/servlet/ServletConfig;) Lorg/apache/tomcat/InstanceManager


joined on
March 27,2014
Asked on April 01,2015
I am running Spring MVC application with Tomcat 8 and Gradle.
My Gradle dependencies are 

dependencies {
compile 'org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE'
compile 'jstl:jstl:1.2'

When I run my application, I am getting error. Need help to resolve it.

java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager

(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, 

org/apache/jsp/views/result_jsp, and the class loader (instance of java/net/URLClassLoader) for resolved class, org/apache/jasper/runtime/InstanceManagerFactory, have 

different Class objects for the type .getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager; used in the signature
org.apache.jsp.views.result_jsp._jspInit(result_jsp.java:32)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


joined on
March 14,2013
Replied on April 01,2015

The error is because, from your spring boot starter web, tomcat embed jar are also included at run time. You need to exclude tomcat embed from runtime. Your gradle should be  

dependencies {
compile 'org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE'
compile 'jstl:jstl:1.2'
configurations {
    runtime.exclude module: 'spring-boot-starter-tomcat'
}

Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us