尝试清理和打包时,illegalstate未能加载应用程序

nom7f22z  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(166)

我有一个spring引导应用程序,如果我从eclipse启动它,它可以正常工作,但是如果我尝试从命令行启动命令“mvnw clean package”,我会得到以下错误:
illegalstate无法加载应用程序
有什么建议吗?这是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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.2.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany.ingestion</groupId>
<artifactId>scheduling-tasks</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>scheduling-tasks</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <exclusions>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>3.1.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-to-slf4j</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jul-to-slf4j</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>

</build>

这是stacktrace的一部分:

2020-12-23 08:54:28,794 1362 [main] INFO  c.n.i.test.ScheduledTasksTest - Starting ScheduledTasksTest on vt-palmast with PID 11528 (started by PalmaSt in C:\Progetti\projbib\bibServices\gs-scheduling-tasks-master\complete)

2020-12-23 08:54:28795 1363[main]info c.n.i.test.scheduledtaskstest-未设置活动配置文件,返回默认配置文件:default 2020-12-23 08:54:29,960 2528[main]warn o.s.c.a.annotationconfigapplicationcontext-上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.unsatifieddependencyException:创建名为“scheduledtasks”的bean时出错:通过字段“tdtitoservice”表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.unsatifieddependencyException:创建名为“tdtitoservice”的bean时出错:通过字段“repository”表示的未满足的依赖关系;嵌套的异常为org.springframework.beans.factory.nosuchbeandefinitionexception:没有类型为“com.mycompany.ingestion.repositories.tdtitorepository”的合格bean可用:至少需要1个符合autowire候选的bean。依赖项注解:{@org.springframework.beans.factory.annotation.autowired(required=true)}2020-12-23 08:54:29972 2540[main]信息o.s.b.a.l.conditionevaluationreportlogginglistener-
启动applicationcontext时出错。要显示条件报告,请在启用“调试”的情况下重新运行应用程序。2020-12-23 08:54:30181 2749[main]错误o.s.b.d.loggingfailureanalysisreporter-应用程序启动失败
说明:
com.mycompany.ingestion.services.tdtitoservice中的字段存储库需要找不到类型为“com.mycompany.ingestion.repositories.tdtitorepository”的bean。
注入点具有以下注解:-@org.springframework.beans.factory.annotation.autowired(required=true)
行动:
考虑在配置中定义一个类型为“com.mycompany.ingestion.repositories.tdtitorepository”的bean。
2020-12-23 08:54:31,493 4061[main]错误o.s.test.context.testcontextmanager-允许testexecutionlistener[org.springframework.boot.test.autoconfigure]时捕获到异常。springbootdependencyinjectiontestexecutionlistener@26a529dc]准备测试示例[com.mycompany.ingestion.test]。schedulingtasksapplicationtest@38eb2c50]java.lang.illegalstateexception异常:未能在org.springframework.test.context.cache.defaultcacheawarecontextloaderdelegate.loadcontext(defaultcacheawarecontextloaderdelegate)加载applicationcontext。java:132)在org.springframework.test.context.support.defaulttestcontext.getapplicationcontext(defaulttestcontext。java:123)在org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.injectdependencies(dependencyinjectiontestexecutionlistener)。java:118)在org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.preparetestinstance(dependencyinjectiontestexecutionlistener。java:83)在org.springframework.boot.test.autoconfigure.springbootdependencyinjectiontestexecutionlistener.preparetestinstance(springbootdependencyinjectiontestexecutionlistener)。java:43)在org.springframework.test.context.testcontextmanager.preparetestinstance(testcontextmanager。java:244)在org.springframework.test.context.junit.jupiter.springextension.postprocesstestinstance(springextension。java:98)位于org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.lambda$invoketestinstancepostprocessors$5(classbasedtestdescriptor)。java:337)在org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.executeandmaskthrowable(classbasedtestdescriptor)。java:342)位于org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.lambda$invoketestinstancepostprocessors$6(classbasedtestdescriptor)。java:337)在java.util.stream.referencepipeline$3$1.accept(referencepipeline。java:193)在java.util.stream.referencepipeline$2$1.accept(referencepipeline。java:175)在java.util.arraylist$arraylistspliterator.foreachremaining(arraylist。java:1382)在java.util.stream.abstractpipeline.copyinto(abstractpipeline。java:482)在java.util.stream.abstractpipeline.wrapandcopyinto(abstractpipeline。java:472)在java.util.stream.streamspliterators$wrappingspliterator.foreachremaining(streamspliterators。java:312)在java.util.stream.streams$concatspliterator.foreachremaining(streams。java:743)在java.util.stream.streams$concatspliterator.foreachremaining(streams。java:742)在java.util.stream.referencepipeline$head.foreach(referencepipeline。java:580)在junit.jupiter.engine.descriptor.classbasedtestdescriptor.invoketestinstancepostprocessors(classbasedtestdescriptor)。java:336)在org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.InstanceAndPostProcessTestInstance(classbasedtestdescriptor。java:259)在org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.lambda$testinstancesprovider$2(classbasedtestdescriptor)。java:252)在java.util.optional.orelseget(可选。java:267)位于org.junit.jupiter.engine.descriptor.classbasedtestdescriptor.lambda$testinstancesprovider$3(classbasedtestdescriptor)。java:251)在junit.jupiter.engine.execution.testinstancesprovider.gettestinstances(testinstancesprovider。java:29)在org.junit.jupiter.engine.descriptor.testmethodtestdescriptor.lambda$prepare$0(testmethodtestdescriptor)。java:106)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)在org.junit.jupiter.engine.descriptor.testmethodtestdescriptor.prepare(testmethodtestdescriptor。java:105)在org.junit.jupiter.engine.descriptor.testmethodtestdescriptor.prepare(testmethodtestdescriptor。java:69)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$prepare$1(nodetesttask。java:107)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)在org.junit.platform.engine.support.hierarchy.nodetesttask.prepare(nodetesttask。java:107)在org.junit.platform.engine.support.hierarchy.nodetesttask.execute(nodetesttask。java:75)在java.util.arraylist.foreach(arraylist。java:1257)在org.junit.platform.engine.support.hierarchical.samethreadherarchicaltestexecutorservice.invokeall(samethreadherarchicaltestexecutorservice)。java:38)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$executecursively$5(nodetesttask。java:139)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$executecursively$7(nodetesttask。java:125)在org.junit.platform.engine.support.hierarchy.node.around(node。java:135)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$execute执行$8(nodetesttask。java:123)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)位于org.junit.platform.engine.support.hierarchical.nodetesttask.executerecursively(nodetesttask。java:122)在org.junit.platform.engine.support.hierarchy.nodetesttask.execute(nodetesttask。java:80)在java.util.arraylist.foreach(arraylist。java:1257)位于org.junit.platform.engine.support.hierarchical.samethreadherarchicaltestexecutorservice.invokeall(samethreadherarchicaltestexecutorservice)。java:38)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$execute执行$5(nodetesttask。java:139)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$executecursively$7(nodetesttask。java:125)在org.junit.platform.engine.support.hierarchy.node.around(节点。java:135)在org.junit.platform.engine.support.hierarchy.nodetesttask.lambda$executecursively$8(nodetesttask。java:123)在org.junit.platform.engine.support.hierarchical.throwablecollector.execute(throwablecollector。java:73)在org.junit.platform.engine.support.hierarchical.nodetesttask.executeRecursive(nodetesttask。java:122)在org.junit.platform.engine.support.hierarchy.nodetesttask.execute(nodetesttask。java:80)位于org.junit.platform.engine.support.hierarchical.samethreadherarchicaltestexecutorservice.submit(samethreadherarchicaltestexecutorservice)。java:32)在org.junit.platform.engine.support.hierarchical.hierarchicaltestexecutor.execute(hierarchicaltestexecutor。java:57)在org.junit.platform.engine.support.hierarchical.hierarchicaltestengine.execute(hierarchicaltestengine。java:51)在org.junit.platform.launcher.core.defaultlauncher.execute(defaultlauncher。java:220)在org.junit.platform.launcher.core.defaultlauncher.lambda$执行$6(defaultlauncher。java:188)在org.junit.platform.launcher.core.defaultlauncher.withinterceptedstreams(defaultlauncher。java:202)在org.junit.platform.launcher.core.defaultlauncher.execute(defaultlauncher。java:181)在org.junit.platform.launcher.core.defaultlauncher.execute(defaultlauncher。java:128)在org.apache.maven.surefire.junitplatform.junitplatformprovider.invokealltests(junitplatformprovider。java:150)位于org.apache.maven.surefire.junitplatform.junitplatformprovider.invoke(junitplatformprovider)。java:124)在org.apache.maven.surefire.booter.forkedbooter.invokeproviderinsameclassloader(forkedbooter。java:384)在org.apache.maven.surefire.booter.forkedbooter.runsuitesinprocess(forkedbooter。java:345)在org.apache.maven.surefire.booter.forkedbooter.execute(forkedbooter。java:126)位于org.apache.maven.surefire.booter.forkedbooter.main(forkedbooter.com)。java:418) 原因:org.springframework.beans.factory.unsatifieddependencyException:创建名为“scheduledtasks”的bean时出错:通过字段“tdtitoservice”表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.unsatifieddependencyException:创建名为“tdtitoservice”的bean时出错:通过字段“repository”表示的未满足的依赖关系;嵌套的异常为org.springframework.beans.factory.nosuchbeandefinitionexception:没有类型为“com.mycompany.ingestion.repositories.tdtitorepository”的合格bean可用:应为

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题