boot-starter-parent バージョン: 2.0.4.RELEASE を使用して、Spring アプリを spring-boot に変換しています。mvn install を使用してビルドすると問題なく動作しますが、 command: を使用してアプリを実行しようとすると、次のmvn spring-boot:run -Dspring.profiles.active=dev
例外が発生します: ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
ここに私のpomの依存関係があります:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.24</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.0-alpha4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.3.0-alpha4</version>
</dependency>
</dependencies>
この質問のアドバイスに従い、新しいバージョンと古いバージョンの logback (コアとクラシックの両方) の依存関係を使用し、「slf4j-log4j12」と「slf4j-simple」を追加しようとしましたが、それでも例外が発生します。スタック トレースは次のとおりです。
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext (LogbackLoggingSystem.java:285) at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize (LogbackLoggingSystem) .java:102) org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent (LoggingApplicationListener.java:191) で org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent (LoggingApplicationListener.java:170) で org. org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster.java:139) org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster.java:122) で org.springframework.boot.context.event.EventPublishingRunListener.starting (EventPublishingRunListener.java:68) で org.springframework.boot.SpringApplicationRunListeners .starting (SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run (SpringApplication.java:316) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) at org.springframework.boot. SpringApplication.run (SpringApplication.java:1246) at com.hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)org.springframework.boot.context.event.EventPublishingRunListener.starting (EventPublishingRunListener.java:68) の multicastEvent (SimpleApplicationEventMulticaster.java:122) org.springframework.boot.SpringApplicationRunListeners.starting (SpringApplicationRunListeners.java:48) の org.springframework .boot.SpringApplication.run (SpringApplication.java:316) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1246) at com. hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)org.springframework.boot.context.event.EventPublishingRunListener.starting (EventPublishingRunListener.java:68) の multicastEvent (SimpleApplicationEventMulticaster.java:122) org.springframework.boot.SpringApplicationRunListeners.starting (SpringApplicationRunListeners.java:48) の org.springframework .boot.SpringApplication.run (SpringApplication.java:316) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1246) at com. hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)springframework.boot.SpringApplicationRunListeners.starting (SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run (SpringApplication.java:316) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) at org .springframework.boot.SpringApplication.run (SpringApplication.java:1246) at com.hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)springframework.boot.SpringApplicationRunListeners.starting (SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run (SpringApplication.java:316) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) at org .springframework.boot.SpringApplication.run (SpringApplication.java:1246) at com.hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)hbo.esp.MyApplication.main (MyApplication.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0 (ネイティブ メソッド)