首页 > 编程语言 > 详细

SpringBoot官网快捷生成springboot工程,java.lang.IllegalArgumentException异常

时间:2020-05-28 09:38:29      阅读:65      评论:0      收藏:0      [点我收藏+]

启动微服务报错

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/maven/MavenRepository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/F:/maven/MavenRepository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
SLF4J: The requested version 1.5.6 by your slf4j binding is not compatible with [1.6, 1.7]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.JDK14LoggerFactory loaded from file:/F:/maven/MavenRepository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar). If you are using WebLogic you will need to add ‘org.slf4j‘ to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.JDK14LoggerFactory
    at org.springframework.util.Assert.instanceCheckFailed(Assert.java:696)
    at org.springframework.util.Assert.isInstanceOf(Assert.java:596)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:284)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:104)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:232)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:213)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
    at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:74)
    at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:47)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at com.example.leetcodedemo.LeetcodedemoApplication.main(LeetcodedemoApplication.java:10)

解决办法:spring-boot-starter剔除spring-boot-starter-logging包

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

结果:

  .   ____          _            __ _ _
 /\\ / ___‘_ __ _ _(_)_ __  __ _ \ \ \ ( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  ‘  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.0.RELEASE)

[2020-05-28 01:01:21.114] - 7392 信息 [main] --- com.example.leetcodedemo.LeetcodedemoApplication: Starting LeetcodedemoApplication on SKY-20191123SMQ with PID 7392 (E:\personal\personal\leetcodedemo\target\classes started by Administrator in E:\personal\personal\leetcodedemo)
[2020-05-28 01:01:21.119] - 7392 信息 [main] --- com.example.leetcodedemo.LeetcodedemoApplication: No active profile set, falling back to default profiles: default
五月 28, 2020 1:01:22 上午 org.springframework.boot.web.embedded.tomcat.TomcatWebServer initialize
信息: Tomcat initialized with port(s): 8080 (http)
五月 28, 2020 1:01:22 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Tomcat]
五月 28, 2020 1:01:22 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet engine: [Apache Tomcat/9.0.35]
五月 28, 2020 1:01:22 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring embedded WebApplicationContext
五月 28, 2020 1:01:22 上午 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext prepareWebApplicationContext
信息: Root WebApplicationContext: initialization completed in 1148 ms
五月 28, 2020 1:01:22 上午 org.springframework.scheduling.concurrent.ExecutorConfigurationSupport initialize
信息: Initializing ExecutorService ‘applicationTaskExecutor‘
五月 28, 2020 1:01:22 上午 org.springframework.boot.web.embedded.tomcat.TomcatWebServer start
信息: Tomcat started on port(s): 8080 (http) with context path ‘‘
五月 28, 2020 1:01:22 上午 org.springframework.boot.StartupInfoLogger logStarted
信息: Started LeetcodedemoApplication in 1.889 seconds (JVM running for 2.584)

 

SpringBoot官网快捷生成springboot工程,java.lang.IllegalArgumentException异常

原文:https://www.cnblogs.com/fc1007/p/12977754.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!