Java Intro to Java Web Development with Spark Diving into Web Development Meet Spark

browser shows ERR_EMPTY_RESPONSE

seems work on console but browser shows ERR_EMPTY_RESPONSE

3 Answers

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

Could you paste your code, especially Main class and messages printed in console when you hit run.

Here is a link to GitHub project, just in case. So that you can compare your files, to Craig's project

https://github.com/treehouse-projects/java-spark-course-ideas

It would be even greater if you can post your project on GItHub.

It is pretty easy if you use Intellijidea and have GitHub account registered (almost one click):

https://www.jetbrains.com/help/idea/2016.2/share-project-on-github-dialog.html

But at least Main class, and console log you have to print ...

public class Main { public static void main(String[] args) { get("/hello", (req, res) -> "Hello World"); }

console:

"C:\Program Files\Java\jdk1.8.0_91\bin\java" [Thread-0] INFO org.eclipse.jetty.util.log - Logging initialized @480ms [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ... [Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:4567 [Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.3.6.v20151106 [Thread-0] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector@6c04f526{HTTP/1.1,[http/1.1]}{0.0.0.0:4567} [Thread-0] INFO org.eclipse.jetty.server.Server - Started @1391ms

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

Ok. good tell me at which address you are opening your browser?

That is the page at which your app will work

http://localhost:4567/hello

If you type any other address that the one before, it should not work...

Just to make sure: is that the address you open in browser?

If yes, could you copy/paste or make screenshot of page response ...

And build.gradle file just in case...

Is it just one sentence nothing else, no status or anything?

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

From what I googled it is rather the problem with the firewall/browser... this ERR_EMPTY_RESPONSE...

Which OS are you using?

Try in a different browser: Safari/Firefox... Does it give the same thing?

I tried on Windows , tried different browsers (Chrome, Firefox, Internet Explorer) and changed firewall settings did not work. I will try on Ubuntu soon. Thanks for reply.