I got an error! SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
I made sure the code was the exact same as the teacher had it. I can't figure out what I did wrong! :(
Alexander NikiforovJava Web Development Techdegree Graduate 22,150 Points
Check out the Spark Documentation about this problem (Logging section) : http://sparkjava.com/documentation.html#examples
There it says, how to deal with the problem very easily: to add
slf4j-simple logging library dependencies.
No need to go back to Spark 2.3 :)
To make it work for version 2.5, you can add the following dependency in build.gradle file.
After a google search, I figured out that I needed to change compile 'com.sparkjava:spark-core:2.5' to compile 'com.sparkjava:spark-core:2.3'
if you run into a binding error
[Thread-0] ERROR spark.embeddedserver.jetty.EmbeddedJettyServer - ignite failed java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
fireoff your task manager and check who is using port 4567
bascially, do this is a dos window netstat -anob | findstr "4567"
this will show you the process id
C:\WINDOWS\system32> netstat -anob | findstr "4567" TCP 0.0.0.0:4567 0.0.0.0:0 LISTENING 4184 TCP [::]:4567 [::]:0 LISTENING 4184
in my case PID is 4184
go to task manager and kill it.
then run your spark example
Rares ConeaPro Student 15,000 Points
Hi, This question is old but if there is someone who still has this problem add before the get method this line: port(<a number that represent the port which you want to use>) Ex: port(8080)