简体   繁体   中英

how can I update to more recent RELEASE of the org.springframework spring-web.jar

I am building "Hello World" Spring MVC project through STS and Maven dependencies. I have Spring-core,beans and context 4.3.6-RELEASE.jars. But Spriing-web and Spring-webmvc 3.1.1-RELEASE.jar When I am starting Tomcat server v7.0 it is giving Errors:

ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: 
Failed to read candidate component class: file [C:\Users\jimme\Documents\Spring\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SpringMvcDemo-18thFeb\WEB-INF\classes\co\edureka\myapp\HomeController.class]; 
nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Users\jimme\Documents\Spring\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SpringMvcDemo-18thFeb\WEB-INF\classes\co\edureka\myapp\HomeController.class]; 
nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

Is it due to the release version of the spring-web and webmvc jars? If I want to update spring-web and webmvc to 4.3.6-RELEASE.jar how can I do that? Can someone please help me?

If you want to update the version of dependencies it is as simple as updating your pom.xml with the desired version.

However I would suggest you to do the following set up so all your spring dependencies in maven are consistent with the same version

<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/maven-v4_0_0.xsd">
    ...
    ...
<properties>
    <spring.version>4.3.6.RELEASE</spring.version>
    <jstl.version>1.2</jstl.version>
</properties>

<dependencies>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        ...
</dependencies>
</project>

First Rightclick -> Run as -> Maven Clean then Run as -> Maven Install

${spring.version} will make sure that all are of the same version, and also updating (upgrading) to a newer version is also a breeze.

Hope it helped!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM