spring-boot和shedlock -如何追踪依赖冲突?

qvtsj1bj  于 2023-11-16  发布在  Spring
关注(0)|答案(2)|浏览(112)

我需要在一个使用shedlock的微服务项目中更新spring-boot的次要版本。
如果spring-boot是在2.0.x版本上,它工作得很好,但是如果我将它升级到2.1.x,测试应用程序maven构建中断并给予此输出。

java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z

at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:81)
at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:294)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:224)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:195)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

字符串
Maven依赖树是:
i.b.l:oaa:war:0.0.8-发布
+- i.b.l:domain:jar:0.0.6-SNAPSHOT:compile|- com.fasterxml.Jackson.datatype:jackson-datatype-jsr310:jar:2.9.7:compile| +- com.fasterxml.Jackson.core:jackson-annotations:jar:2.9.0:compile
| - com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile
+- org.springframework. Boot :spring- Boot -starter:jar:2.1.1.RELEASE:compile| +- org.springframework. Boot :spring- Boot :jar:2.1.1.RELEASE:compile
| +- javax.annotation:javax.annotation-api:jar:1.3.2:compile| +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
| +- org.springframework:spring-core:jar:5.1.3.RELEASE:compile
| | - org.springframework:spring-jcl:jar:5.1.3.RELEASE:compile
| - org.yaml:snakeyaml:jar:1.23:compile
+-com.oracle:ojdbc6:jar:11.2.0:compile
+- org.springframework. Boot :spring- Boot -starter-web:jar:2.1.1.RELEASE:compile| +- org.springframework. Boot :spring- Boot -starter-json:jar:2.1.1.RELEASE:compile||+- com.fasterxml.Jackson.datatype:jackson-datatype-jdk8:jar:2.9.7:compile||- com.fasterxml.Jackson.module:jackson-module-parameter-names:jar:2.9.7:compile| +- org.hibernate.validator:hibernate-validator:jar:6.0.13.Final:compile
| | +- javax.validation:validation-api:jar:2.0.1.Final:compile
| | - org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
| +- org.springframework:spring-web:jar:5.1.3.RELEASE:compile
| | - org.springframework:spring-beans:jar:5.1.3.RELEASE:compile
| - org.springframework:spring-webmvc:jar:5.1.3.RELEASE:compile
| +- org.springframework:spring-aop:jar:5.1.3.RELEASE:compile
| - org.springframework:spring-expression:jar:5.1.3.RELEASE:compile
+- org.springframework. Boot :spring- Boot -starter-tomcat:jar:2.1.1.RELEASE:已提供|+- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.13:已提供
| +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.13:provided
| - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.13:provided
+- org.springframework. Boot :spring- Boot -starter-jdbc:jar:2.1.1.RELEASE:compile| +- com.zaxxer:HikariCP:jar:3.2.0:compile
| - org.springframework:spring-jdbc:jar:5.1.3.RELEASE:compile
| - org.springframework:spring-tx:jar:5.1.3.RELEASE:compile
+- org.springframework. Boot :spring- Boot -starter-actuator:jar:2.1.1.RELEASE:compile| +- org.springframework. Boot :spring- Boot -actuator-autoconfigure:jar:2.1.1.RELEASE:compile||- org.springframework. Boot :spring- Boot -actuator:jar:2.1.1.RELEASE:compile|- io.micrometer:micrometer-core:jar:1.1.1:compile
| +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
| - org.latencyutils:LatencyUtils:jar:2.0.3:compile
+- org.springframework. Boot :spring- Boot -starter-test:jar:2.1.1.RELEASE:compile| +- org.springframework. Boot :spring- Boot -test:jar:2.1.1.RELEASE:compile
| +- com.jayway.jsonpath:json-path:jar:2.4.0:compile| +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
| | - net.minidev:json-smart:jar:2.3:compile
| | - net.minidev:accessors-smart:jar:1.2:compile
| | - org.ow2.asm:asm:jar:5.0.4:compile
| +- junit:junit:jar:4.12:compile
| +- org.assertj:assertj-core:jar:3.11.1:compile
| +- org.hamcrest:hamcrest-core:jar:1.3:compile
| +- org.hamcrest:hamcrest-library:jar:1.3:compile
| +- org.skyscreamer:jsonassert:jar:1.5.0:compile
| | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile | +- org.springframework:spring-test:jar:5.1.3.RELEASE:compile
| - org.xmlunit:xmlunit-core:jar:2.6.2:compile
+- org.springframework. Boot :spring- Boot -starter-log4j 2:jar:2.1.1.RELEASE:compile| +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.1:compile
| | - org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
| +- org.apache.logging.log4j:log4j-core:jar:2.11.1:compile
| +- org.apache.logging.log4j:log4j-jul:jar:2.11.1:compile
| - org.slf4j:jul-to-slf4j:jar:1.7.25:compile
+- org.apache.httpcomponents:httpclient:jar:4.5.6:compile| +- commons-logging:commons-logging:jar:1.2:compile
| - commons-codec:commons-codec:jar:1.10:compile
+- org.apache.httpcomponents:httpcore:jar:4.4.10:compile
+- com.fasterxml.Jackson.dataformat:jackson-dataformat-yaml:jar:2.9.7:compile|- com.fasterxml.Jackson.core:jackson-core:jar:2.9.7:compile
+- io.springfox:springfox-swagger2:jar:2.9.2:compile| +- io.swagger:swagger-annotations:jar:1.5.20:compile
| +- io.swagger:swagger-models:jar:1.5.20:compile
| +- io.springfox:springfox-spi:jar:2.9.2:compile
| | - io.springfox:springfox-core:jar:2.9.2:compile
| +- io.springfox:springfox-schema:jar:2.9.2:compile
| +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
| +- io.springfox:springfox-spring-web:jar:2.9.2:compile
| +- com.google.guava:guava:jar:20.0:compile
| +- com.fasterxml:classmate:jar:1.4.0:compile
| +- org.slf4j:slf4j-api:jar:1.7.25:compile

| +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile|- org.mapstruct:mapstruct:jar:1.2.0.Final:compile| - org.mapstruct:mapstruct:jar:1.2.0.Final:compile
+- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
+- org.projectlombok:lombok:jar:1.18.4:compile
+- org.apache.commons:commons-lang3:jar:3.8.1:compile
+- com.h2database:h2:jar:1.4.197:compile
+- org.springframework. Boot :spring- Boot -starter-data-jpa:jar:2.1.1.RELEASE:compile| +- org.springframework. Boot :spring- Boot -starter-aop:jar:2.1.1.RELEASE:compile||aspectj:aspectjweaver:jar:1.9.2:compile
| +- javax.transaction:javax.transaction-api:jar:1.3:compile
| +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
| | - javax.activation:javax.activation-api:jar:1.2.0:compile
| +- org.hibernate:hibernate-core:jar:5.3.7.Final:compile
| | +- javax.persistence:javax.persistence-api:jar:2.2:compile
| | +- org.javassist:javassist:jar:3.23.1-GA:compile
| | +- antlr:antlr:jar:2.7.7:compile
| | +- org.jboss:jandex:jar:2.0.5.Final:compile
| | +- org.dom4j:dom4j:jar:2.1.1:compile
| | - org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile | +- org.springframework.data:spring-data-jpa:jar:2.1.3.RELEASE:compile
| | - org.springframework.datacompile|| - org.springframework:spring-orm:jar:5.1.3.RELEASE:compile
| - org.springframework:spring-aspects:jar:5.1.3.RELEASE:compile
+- org.mockito:mockito-core:jar:2.21.0:编译|+- net.bytebuddy:bytebuddy:jar:1.8.15:compile
| +- net.bytebuddy:byte-buddy-agent:jar:1.8.15:compile
| - org.objenesis:objenesis:jar:2.6:compile
+- commons-io:commons-io:jar:2.6:compile
+- org.powermock:powermock-module-junit4:jar:2.0.0:test|- org.powermock:powermock-module-junit4-common:jar:2.0.0:test
| +- org.powermock:powermock-reflect:jar:2.0.0:test
| - org.powermock:powermock-core:jar:2.0.0:test
+- org.powermock:powermock-api-mockito2:jar:2.0.0:test|- org.powermock:powermock-api-support:jar:2.0.0:test
+- net.javacrumbs.shedlock:shedlock-spring:jar:2.5.0:compile| +- net.javacrumbs.shedlock:shedlock-core:jar:2.5.0:compile
| - org.springframework:spring-context:jar:5.0.6.RELEASE:compile
+- net.javacrumbs.shedlock:shedlock-provider-jdbc-template:jar:2.5.0:compile|- net.javacrumbs.shedlock:shedlock-provider-jdbc-internal:jar:2.5.0:编译- javax.mail:mail:jar:1.4:编译

  • javax.activation:激活:jar:1.1:编译
    pom.xml是:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>i.b.l</groupId>
    <artifactId>oaa</artifactId>
    <version>0.0.8-RELEASE</version>
    <packaging>war</packaging>

    <properties>
        <domain.version>0.0.6-SNAPSHOT</domain.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
        <log4j.version>1.2.17</log4j.version>
        <httpclient.version>4.5.6</httpclient.version>
        <httpcore.version>4.4.10</httpcore.version>
        <jackson-dataformat-yaml.version>2.9.7</jackson-dataformat-yaml.version>
        <swagger.version>2.9.2</swagger.version>
        <lombok.version>1.18.4</lombok.version>
        <commons-lang3.version>3.8.1</commons-lang3.version>
        <maven-checkstyle-version>3.0.0</maven-checkstyle-version>
        <h2database.version>1.4.197</h2database.version>
        <mockito.version>2.21.0</mockito.version>
        <ojdbc.version>11.2.0</ojdbc.version>
        <shedlock.version>2.5.0</shedlock.version>
        <commons-io.version>2.6</commons-io.version>
        <powermock.version>2.0.0</powermock.version>
        <javax-mail.version>1.4</javax-mail.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>i.b.l</groupId>
            <artifactId>domain</artifactId>
            <version>${domain.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>${spring.boot.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>${ojdbc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcore.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>${jackson-dataformat-yaml.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2database.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito2</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.shedlock</groupId>
            <artifactId>shedlock-spring</artifactId>
            <version>${shedlock.version}</version>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.shedlock</groupId>
            <artifactId>shedlock-provider-jdbc-template</artifactId>
            <version>${shedlock.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>${javax-mail.version}</version>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>**/*.jks</exclude>
                </excludes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webXml>src/main/resources/web.xml</webXml>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-version}</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>java-checkstyle-rules.xml</configLocation>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <url>http://d1f2fwc2w7.boigroup.net:8081/nexus/repository/maven-releases</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <url>http://d1f2fwc2w7.boigroup.net:8081/nexus/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>local</id>
            <properties>
                <activatedProfiles>local</activatedProfiles>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prd</id>
            <properties>
                <activatedProfiles>prd</activatedProfiles>
            </properties>
        </profile>
        <profile>
            <id>war</id>
            <properties>
                <activatedProfiles>war</activatedProfiles>
            </properties>
        </profile>
    </profiles>

</project>


我把这个贴到了ShedLock问题页面,他们说这更有可能是一个冲突的依赖关系的问题,而不是ShedLock的问题。
我怎样才能把这个修好?

mzsu5hc0

mzsu5hc01#

通过将shedlock的<dependency />更改为:

<dependency>
        <groupId>net.javacrumbs.shedlock</groupId>
        <artifactId>shedlock-spring</artifactId>
        <version>${shedlock.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

字符串

eeq64g8w

eeq64g8w2#

你可以修正Shedlock jar依赖的版本。如果你看到一个或多个jar的冲突,也可以排除它。

<dependency>
        <groupId>net.javacrumbs.shedlock</groupId>
        <artifactId>shedlock-spring</artifactId>
        <version>xxx</version>
       
    </dependency>

字符串

相关问题