我将我的Java应用程序从Spring4升级到了Spring5,在tomcat服务器上运行时,我得到了java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError错误。其次是org.springframework.beans.factory.access.BeanFactoryReference :java.lang.ClassNotFoundException
请帮我解决这个问题。
下面是我的build.gradle文件中的依赖项
compile 'org.springframework:spring-context-support:5.2.11.RELEASE'
compile 'org.springframework:spring-webmvc:5.2.11.RELEASE'
compile 'org.springframework.security:spring-security-config:5.2.8.RELEASE'
compile 'org.springframework.security:spring-security-web:5.2.8.RELEASE'
compile 'org.springframework.security:spring-security-ldap:5.2.8.RELEASE'
compile 'org.springframework.integration:spring-integration-sftp:5.2.11.RELEASE'
compile 'org.springframework.ws:spring-ws-core:3.0.9.RELEASE'
compile 'com.thoughtworks.xstream:xstream:1.4.14'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.10'
compile 'wsdl4j:wsdl4j:1.6.3'
compile 'commons-discovery:commons-discovery:0.2'
compile 'javax.xml:jaxrpc-api:1.1'
compile 'com.google.guava:guava:24.1.1-android'
compile('org.apache.poi:poi-ooxml:4.1.2') {
exclude group: 'stax', module: 'stax-api'
}
compile 'javax.validation:validation-api:1.1.0.Final'
compile 'org.hibernate:hibernate-validator:5.1.3.Final'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'commons-fileupload:commons-fileupload:1.4'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'
compile 'com.lmax:disruptor:3.3.4'
compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
compile 'org.apache.commons:commons-csv:1.2'
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
providedCompile 'javax.servlet.jsp.jstl:jstl-api:1.2'
providedCompile 'javax.servlet:jstl:1.2'
providedCompile 'org.glassfish.web:jstl-impl:1.2'
providedCompile 'com.microsoft.sqlserver:sqljdbc4:2.0'
providedCompile 'javax.xml.bind:jaxb-api:2.2.12'
testCompile 'org.springframework:spring-test:5.2.11.RELEASE'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'foo-commonj:foo-commonj:1.1.0'
testCompile 'commonj-twm:commonj-twm:1.1.0'
integrationTestCompile sourceSets.main.output
integrationTestCompile configurations.testCompile
integrationTestCompile sourceSets.test.output
integrationTestRuntime configurations.testRuntime如果我需要更多的信息,请告诉我。
发布于 2021-02-07 13:39:30
我自己解决的。我用tomcat ->清理了tomcat的历史我做了gradle刷新,在tomcat服务器上再次运行并解决了问题。
Tomcat采用了应用程序的旧版本。在以前的构建中,我有spring core:2.x.RELEASE,它带来了spring-beans.4.x.jar,与其他Spring5JAR不兼容。因此,根本原因是不兼容的jars,然后是tomcat缓存构建。
https://stackoverflow.com/questions/66082239
复制相似问题