Failed to import bean definitions from URL location

0

I'm creating a project with spring-mvc and MongoDB, when I start the Tomcat server from Eclipse it gives me the following error:

  

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:   Configuration problem: Failed to import bean definitions from URL   location [classpath: core.xml]

     

Offending resource: ServletContext resource   [/WEB-INF/spring-servlet.xml]; nested exception is   org.springframework.beans.factory.BeanDefinitionStoreException: Failed   to read candidate component class: file   [F: \ Programs \ Programming \ apache-tomcat-8.5.16 \ wtpwebapps \ SpringMongo \ WEB-INF \ classes \ en \ arf \ controller \ NavigationController.class];   nested exception is java.lang.IncompatibleClassChangeError: class   org.springframework.core.type.classreading.ClassMetadataReadingVisitor   has interface org.springframework.asm.ClassVisitor as super class

this is my spring-servlet.xml file:

    <?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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<import resource="classpath:core.xml"/>

<mvc:default-servlet-handler />
<mvc:annotation-driven/>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

this is my core.xml file

    <?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:aop="http://www.springframework.org/schema/aop" 
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="
    http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
    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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="es.arf" />
<aop:aspectj-autoproxy />

<context:property-placeholder location="classpath:appcore.properties"/>

<mongo:db-factory    id="mongoDbFactory" dbname="${mongo.database}" host="${mongo.host}" port="${mongo.port}"/>
<mongo:repositories base-package="es.arf"/>

<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
</bean>


<!-- on startup context execute changesets if needed -->
<!-- 
<mongo:mongo id="mongo" host="${mongo.host}" port="${mongo.port}"/>
<bean id="mongeez" class="org.mongeez.MongeezRunner">    
    <property name="mongo" ref="mongo"/>
    <property name="executeEnabled" value="${executeMigrations}"/>
    <property name="dbName" value="${mongo.database}"/>
    <property name="file" value="classpath:/changeSets/mongeez.xml"/>           
</bean>
-->
    </beans>

I would be delighted to receive your help.

Thanks

    
asked by arf2774 08.08.2017 в 16:49
source

1 answer

1

As indicated here , the problem seems to be that you are importing a jar of spring-asm that it is no longer necessary because it is already included in the core of spring and that makes a version conflict.

Review the answer and, if it still does not work, comment if the project has been built with Maven or Gradle and share the pom.xml or the build.gradle. If you're doing it bareback, share the list of jars you're linking to your project.

Greetings

    
answered by 08.08.2017 в 20:21