gpt4 book ai didi

spring - 将Spring集成依赖项添加到项目中时,LocationAwareLogger异常

转载 作者:行者123 更新时间:2023-12-03 04:42:52 25 4
gpt4 key购买 nike

当我包含spring-batch-integrationspring-integration-filespring-integration-sftp时,它的位置为LocationAwareLogger异常。当我删除它时,一切都很好。在Maven项目中也具有这些确切的依赖关系对我来说很好。

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.apache.commons.configuration.ConfigurationUtils.locate(ConfigurationUtils.java:523)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:213)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:197)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:142)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:237) `spring-integration-sftp`
at com.example.Main.main(Main.java:27)

这行是错误的:
final AbstractApplicationContext context = new ClassPathXmlApplicationContext(
"classpath:spring/batch/config/context.xml",
"classpath:spring/batch/config/spring-batch.xml",
"classpath:spring/batch/config/spring-integration.xml");

我的依赖项是:
versions += [

mavenWagonHttp: "2.2",
kohlsCodingStandards: "2.0.15",
log4j:"1.2.16",
spring:"3.2.2.RELEASE",
springBatch:"2.2.0.RELEASE",
springBatchIntegration:"1.2.2.RELEASE",
springIntegrationFile:"2.1.0.RELEASE",
springIntegrationSFTP:"2.1.0.RELEASE",
mysqlDriver:"5.1.25",
junit:"4.11",
commonsConfiguration:"1.6",
apacheCommonsLang3:"3.3.2",
slf4jLog4j12:"1.5.6"
]

libs += [
mavenWagonHttp: "org.apache.maven.wagon:wagon-http:$versions.mavenWagonHttp",
kohlsCodingStandards: "com.kohls.services:services-coding-standards:$versions.kohlsCodingStandards",
log4j:"log4j:log4j:$versions.log4j",
spring:"org.springframework:spring-core:$versions.spring",
springBatch:"org.springframework.batch:spring-batch-core:$versions.springBatch",
springBatchInfrastructure:"org.springframework.batch:spring-batch-infrastructure:$versions.springBatch",
springBatchIntegration:"org.springframework.batch:spring-batch-integration:$versions.springBatchIntegration",
springIntegrationFile:"org.springframework.integration:spring-integration-file:$versions.springIntegrationFile",
springIntegrationSFTP:"org.springframework.integration:spring-integration-sftp:$versions.springIntegrationSFTP",
springBatchTest:"org.springframework.batch:spring-batch-test:$versions.springBatch",
junit:"junit:junit:$versions.junit",
log4j:"log4j:log4j:$versions.log4j",
commonsConfiguration:"commons-configuration:commons-configuration:$versions.commonsConfiguration",
apacheCommonsLang3:"org.apache.commons:commons-lang3:$versions.apacheCommonsLang3",
slf4jLog4j12:"org.slf4j:slf4j-log4j12:$versions.slf4jLog4j12"
]

dependencies {
compile([
libs.mavenWagonHttp,
libs.kohlsCodingStandards,
libs.log4j,
libs.spring,
libs.springBatch,
libs.springBatchInfrastructure,
libs.springBatchIntegration,
libs.springIntegrationFile,
libs.springIntegrationSFTP,
libs.springBatchTest,
libs.junit,
libs.commonsConfiguration,
libs.apacheCommonsLang3,
libs.slf4jLog4j12
])
compile fileTree(dir: 'lib', include: ['*.jar'])
}

最佳答案

这就是我想出的。我强制slf4j使用1.5.8版,它似乎可以工作。如果还有其他方法可以让我知道,否则我将在明天之前将其标记为最佳答案。

我将此添加到build.gradle

configurations.all {
resolutionStrategy {
force 'org.slf4j:slf4j-log4j12:1.5.8','org.slf4j:slf4j-api:1.5.8'
}
}

关于spring - 将Spring集成依赖项添加到项目中时,LocationAwareLogger异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24740691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com