Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 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.