将spring迁移到spring boot web app!删除了mongodb并添加了Postgres设置

时间:2017-10-13 12:06:00

标签: postgresql spring-boot

Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/classic/Logger
        at com.calamp.common.springboot.dbproperties.DBPropertySourceLoader.<clinit>(DBPropertySourceLoader.java:25)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:135)
        ... 28 more
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.Logger
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
        ... 35 more

1 个答案:

答案 0 :(得分:1)

简短回答:您的项目缺少logback-classic依赖项:

<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.3</version>
    <scope>test</scope>
</dependency>

我猜你没有使用任何依赖管理工具,如Maven,Gradle或Ivy,它们可以自动解决传递依赖。在你的位置,我会研究这些工具(它可能最好从Maven开始)而不是自己管理你的依赖项。