2016-05-27 8 views
0

Ich benutze Spring Boot.Ich habe Spring Boot Grapple-Anwendung erstellt.Ich habe folgenden Fehler.Verursacht von: java.lang.ClassNotFoundException: org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter

Verursacht durch: java.lang.ClassNotFoundException: org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter

build.gradle

buildscript { 
    ext { 
    springBootVersion = '1.3.2.RELEASE' 
} 
repositories { 
    mavenCentral() 
} 
dependencies { 
    classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE") 
} 
} 

apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'spring-boot' 

jar { 
    baseName = 'demo' 
    version = '0.0.1-SNAPSHOT' 
    } 
sourceCompatibility = 1.7 
    targetCompatibility = 1.7 

    repositories { 
    mavenCentral() 
    } 


    dependencies { 
compile('org.springframework.boot:spring-boot-starter-data-mongodb') 
testCompile('org.springframework.boot:spring-boot-starter-test') 
compile group: 'org.springframework', name: 'spring-web', version: '4.0.0.RELEASE' 
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.12' 
compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.12' 
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.2.2' 
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.2.2' 
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.2.2' 
    } 


    eclipse { 
      classpath { 
     containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 
     containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7' 
    } 
    } 

    task wrapper(type: Wrapper) { 
    gradleVersion = '2.9' 
    } 

Bin ich irgendwelche Abhängigkeiten in build.gradle fehlt?

Wie löst man das?

+0

versuchen Sie diesen Link http://stackoverflow.com/questions/27756668/spring-tool-suite-noclassdeffounderror-mappingjackson2xmlhttpmessageconverter – Veeram

+0

Entfernen Sie die 'org.springframework',' org.codehaus.jackson' und 'com.fasterxml.jackson .core' Abhängigkeiten und ersetzen Sie stattdessen mit 'org.springframework.boot: sprig-boot-starter-web'. –

Antwort

0

Sie enthalten zwei verschiedene Versionen der Jackson-Bibliothek. Verwenden Sie für Spring 4+ den com.fasterxml.jackson.core wie Sie haben. Entfernen Sie die zwei org.codehaus.jackson-Abhängigkeiten.

Verwandte Themen