Server Tutorials


#1

September 19, 2017

Happy Coding now has server tutorials!


This is a companion discussion topic for the original entry at http://happycoding.io/blog/server-tutorials

#2

First of all, thank you for doing this. It’s a very helpful resource of information. Your way of presenting these ideas and concepts is very straightforward and clean. I was looking for this kind of resource for very long time.

Regarding the ‘Server Tutorial’: I try to complete the tutorial that explains how the ‘Servlet’ is working. I’ve successfully compiled the class, created the folder structure inside the ‘webapps’ folder, created the web.xml file. But when I go to ‘http://localhost:8080/HelloWorldWebApp/index.html’ I get this error message: “Service unavailable”.

If possible, please explain what is the reason for this.

Error Message


#3

Thanks so much! That’s so awesome to hear!

First off, this is actually good news- it means you’re successfully running your server (because you’ve got the “Powered by Jetty” message at the bottom). Now we just need to figure out your web app.

Can you the contents of your web.xml file? And maybe a screenshot of your directory structure?


#4

Sure, here they are:


#5

Hmm what you have looks correct, and I just verified that it works for me.

How exactly are you running Jetty? Maybe try restarting it?

Googling “jetty service unavailable” returns a bunch of results. These offer some possible explanations:

It looks like the most common causes of the error are problems in your web.xml file, or running Jetty from an IDE instead of the command line.

You should also check the logs directory of your Jetty installation. That might contain errors that will tell you what’s going on.

Keep me updated, I’ll be very curious to see what the problem was, so I can make it more clear in the tutorials.


#6

Not sure why, but it’s working today. Nothing had been changed. It’s strange.

Yes, I was running it from the command line. And I did check the StackOverflow and other resources the same day before going to help to the forum.
Anyway, thanks for the help. I will continue to learn the examples and tutorials.


#7

Heh, gotta love bugs that just go away on their own.

One thing worth remembering is that Jekyll doesn’t always automatically refresh. So if you started Jekyll and then made a change to web.xml for example, it might not have picked up on that change. Restarting Jekyll often fixes problems like this.

Let me know if you have any other questions!