0

I have created a controller which has a method with a @RequestMapping("/"). This is intended to be the default method of the application. Upon running the application, the following error is generated:

"javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(javax/servlet/ServletConfig;)org/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature"

Here's the controller

@Controller
public class TestController {

    @RequestMapping("/")
    @ResponseBody
    public String testMethod() {

        return "Hello World!";
    }

}

My POM file incase it's useful:

<properties>
        <java-version>1.8</java-version>
    </properties>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.0.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>1.2.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.37</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>intranet</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
SheppardDigital
  • 3,165
  • 8
  • 44
  • 74
  • Have a look at this post - http://stackoverflow.com/questions/28097316/unable-to-start-spring-mvc-application-in-spring-tool-suite – Omkar Puttagunta Nov 23 '15 at 12:44
  • 1
    And this might be helpful - http://stackoverflow.com/questions/8487048/java-lang-linkageerror-javax-servlet-jsp-jspapplicationcontext-getexpressionfac – Omkar Puttagunta Nov 23 '15 at 12:47
  • I did look at that earlier, and I've made a number of attempts to exclude the TomCat files, but in doing this Spring Boot doesn't initialise. – SheppardDigital Nov 23 '15 at 12:48
  • As suggested in one of the links above, I deleted the TomCat files from the lib folder one the application was built, and this has resolved the issue. The files don't seem to be being automatically put back in place, so I think this has resolved my issue. Thanks. – SheppardDigital Nov 23 '15 at 12:57

0 Answers0