我已经用Spring Boot编写了最简单的hello world项目。也就是说,当您在浏览器中打开LocalHost:8080时,您将看到“Hello World”字样。我刚刚发现,如果我使用Intellij Community运行项目,IDE可以启动项目,并且我可以在浏览器中打开LocalHost:8080。但是,如果我在Intellij Ultimate中运行相同的项目,它会向我抛出错误。
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-android-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-jcl-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-jdk14-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/xtynd/.m2/repository/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.AndroidLoggerFactory]
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.AndroidLoggerFactory loaded from file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-android-1.7.25.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.AndroidLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:655)
at org.springframework.util.Assert.isInstanceOf(Assert.java:555)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:286)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:102)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:219)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:198)
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:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at io.firstspringboot.SpringApp.main(SpringApp.java:9)
Process finished with exit code 1
我使用的是完全相同的pom.xml。这两个IDE之间的区别是什么?
<?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>io.firstspringboot</groupId>
<artifactId>rest</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
"C:\Program Files\Java\jdk1.8.0_191\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=51923:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_191\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jcl-over-slf4j-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jcl-over-slf4j-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jul-to-slf4j-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jul-to-slf4j-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\log4j-over-slf4j-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\log4j-over-slf4j-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\osgi-over-slf4j-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\osgi-over-slf4j-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-android-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-android-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-api-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-api-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-ext-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-ext-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-jcl-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-jcl-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-jdk14-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-jdk14-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-log4j12-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-log4j12-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-migrator-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-nop-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-nop-1.7.25.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-simple-1.7.25-sources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\slf4j-simple-1.7.25.jar;C:\JavaProj\quickstart\FirstSpringBoot\target\classes;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.1.5.RELEASE\spring-boot-starter-web-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-starter\2.1.5.RELEASE\spring-boot-starter-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot\2.1.5.RELEASE\spring-boot-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.5.RELEASE\spring-boot-autoconfigure-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-core\5.1.7.RELEASE\spring-core-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-jcl\5.1.7.RELEASE\spring-jcl-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.1.5.RELEASE\spring-boot-starter-json-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.8\jackson-core-2.9.8.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.8\jackson-module-parameter-names-2.9.8.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.5.RELEASE\spring-boot-starter-tomcat-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.19\tomcat-embed-core-9.0.19.jar;C:\Users\xtynd\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.19\tomcat-embed-el-9.0.19.jar;C:\Users\xtynd\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.19\tomcat-embed-websocket-9.0.19.jar;C:\Users\xtynd\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.16.Final\hibernate-validator-6.0.16.Final.jar;C:\Users\xtynd\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\xtynd\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\xtynd\.m2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-web\5.1.7.RELEASE\spring-web-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-beans\5.1.7.RELEASE\spring-beans-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-webmvc\5.1.7.RELEASE\spring-webmvc-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-aop\5.1.7.RELEASE\spring-aop-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-context\5.1.7.RELEASE\spring-context-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\spring-expression\5.1.7.RELEASE\spring-expression-5.1.7.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\springframework\boot\spring-boot-starter-log4j2\2.1.5.RELEASE\spring-boot-starter-log4j2-2.1.5.RELEASE.jar;C:\Users\xtynd\.m2\repository\org\apache\logging\log4j\log4j-slf4j-impl\2.11.2\log4j-slf4j-impl-2.11.2.jar;C:\Users\xtynd\.m2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;C:\Users\xtynd\.m2\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;C:\Users\xtynd\.m2\repository\org\apache\logging\log4j\log4j-core\2.11.2\log4j-core-2.11.2.jar;C:\Users\xtynd\.m2\repository\org\apache\logging\log4j\log4j-jul\2.11.2\log4j-jul-2.11.2.jar;C:\Users\xtynd\.m2\repository\org\slf4j\jul-to-slf4j\1.7.26\jul-to-slf4j-1.7.26.jar" io.firstspringboot.SpringApp
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-android-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-jcl-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-jdk14-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Java/jdk1.8.0_191/jre/lib/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/xtynd/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.11.2/log4j-slf4j-impl-2.11.2.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.AndroidLoggerFactory]
Exception in thread "main" java.lang.NoClassDefFoundError: android/util/Log
at org.slf4j.impl.AndroidLoggerAdapter.isLoggable(AndroidLoggerAdapter.java:543)
at org.slf4j.impl.AndroidLoggerAdapter.isErrorEnabled(AndroidLoggerAdapter.java:447)
at org.apache.commons.logging.impl.SLF4JLog.isErrorEnabled(SLF4JLog.java:63)
at org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:857)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:832)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at io.firstspringboot.SpringApp.main(SpringApp.java:9)
Process finished with exit code 1
再次感谢所有的评论和回复。经过一番努力,我终于找到了解决办法。原来是SDK设置有点不同。我受到了关于SFL4J的评论的启发。
首先,我打开文件->项目结构->项目设置->项目,以检查运行项目所用的SDK名称。
其次,在相同的项目结构窗口中,切换到Platform Settings->SDKs,然后单击我用来运行项目的SDK。
接下来我要研究的是那些被删除的额外.jar文件对运行Spring Boot的影响。我想知道哪些。jar文件/依赖关系确切地影响Spring Boot的运行。
我使用kotlin中的EclipsePAHOMQTT库和IntellijIDE中的Gradle创建了一个小型mqtt应用程序。当通过Intellij运行它时,它运行良好,但是当我构建它并运行创建的jar文件时,我会得到一个错误。 从我看到的其他问题来看,这似乎与类路径有关,但我不确定如果这确实是问题所在,需要做什么,因为我使用的是gradle而不是jar文件作为库。 我正在学习这个教程 这是我的档
我是IntelliJ社区版的新手。谁能帮我在intelliJ社区版创建spring boot项目。对于ultimate edition有spring-boot初始化器,但我找不到community edition的任何东西。我跟踪了这个链接,但找不到任何解决方案 “用IntelliJ Community(免费版)在5分钟内创建Spring Boot Project” “Intellij IDEA社
原因:java.lang.ClassNotFoundException:javax.mail.address
主要内容:创建临时配置,创建永久配置,创建新配置,共享配置IntelliJ IDEA 有很多方法可以为正在运行的项目创建配置。配置选项是: 创建临时配置 创建永久配置 在用户之间共享配置 创建临时配置 创建项目 创建Java 类 右键单击并选择运行选项 在运行菜单上添加了临时配置。 创建永久配置 当我们使用 Intellij Idea保存临时配置时,它可以转换为永久配置。要保存此配置,请单击“Run”菜单上的“Save Configuration”。我们
我想从intelliJ运行我的spring-boot应用程序,而不是使用终端,但它不允许,它只是抛出了一大堆错误,而当我从中的终端运行时,应用程序会按预期启动。 通过intelliJ(右上角的run按钮)运行时: 但当我去跑的时候: 在终端中,我的应用程序启动,我可以开始对服务器进行http调用。
刚才我已经安装并开始在Android Studio上工作,并在配置了开始工作所需的一切后创建了新项目。在新创建的项目中,我没有更改任何内容,然后尝试运行该项目。但是它不起作用,我想会出现一些依赖错误。这就是它。 > 出错的地方:发现任务': StudioTest2:'的配置有问题。 为属性“dex文件”指定的文件“C:\Users\StudioTest2\build\libs\StudioTest