Reputation: 19
I have been trying for several days to get the spring boot 15 minute hello world working. I keep encountering the following error:
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.warn(SLF4JLocationAwareLog.java:179)
at org.springframework.boot.SpringApplicationRunListeners.callFinishedListener(SpringApplicationRunListeners.java:91)
at org.springframework.boot.SpringApplicationRunListeners.finished(SpringApplicationRunListeners.java:72)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:810)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
at com.symphony.Application.main(Application.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
I know this question appears elsewhere on the site, I have tried countless things and nothing works. I am using IntelliJ 2016.1.3, Java version 1.8.0._60.
My pom.xml is:
<?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>com.spring</groupId>
<artifactId>com.spring</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.7.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I have tried maven clean from IntelliJ and no luck.
EDIT: Screenshot added to show everything being pulled into project. Maven Dependencies
UPDATE: Completely uninstalled maven 3.3.9 and only have the built in maven from IntelliJ ultimate. Still not working, extremely frustrating. Over a week into this and can't get the 15 minute demo working.
Upvotes: 1
Views: 3473
Reputation: 21
I've run in the same problem, but got it solved by excluding logback-classic
So my pom now Looks like this:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
If you're in Eclipse (idk, if IntelliJ has this Feature too) and look at the dependency hierarchy tab, you'll see, spring-boot itself implements multiple slf4j-apis. Visualization of the dependency hierarchy filtered by "slf4j"
I know it may be too late for you, but your post was one of the first result by Google, so maybe it'll help someone else.
Upvotes: 2
Reputation: 4989
You appear to have an incompatibility with versions of logging frameworks. See if replacing the spring-boot-starter
and spring-web
artifacts with spring-boot-starter-web
helps, as per the current Getting Started guide.
Update
I was able to configure and build the Spring Getting Started guide down to the Add Unit Tests heading without error on Intellij Ultimate 2016.2 using its own embedded Maven 3, and on the command-line using Maven 3.1.1 and Java 8 (1.8.0_31-b13).
I found significant build errors and/or execution errors when I:
spring-boot-starter
and spring-web
artifacts rather than spring-boot-starter-web
.I think your problem is a build configuration error. Whenever I get these, I go back to command-line to build and run just to be sure the problem isn't an artifact of some IDE bug.
Upvotes: 2
Reputation: 3486
your pom lists java 8, but you said you are using java 6 for the project. make sure your project is pointing to a Java 8 ddk.
Upvotes: -1