Entry 10, Day 20
Time to talk a little environment. Go green, plant a tree, that kind of stuff. Kidding. We are going to talk about the server and the data source for the application. First, what is actually a server?
Server in general is something (hardware + software) that provides responses for requests across the network (or even locally). We are mainly interested in web servers, so we have a http request and http response. This doesn’t actually narrow down to www. They are WebServices carried over http via SOAP. You know, machine talking to another machine, skipping the unreliable protein-based components. Since I’m a programmer, not a sysadmin, by the term server I will understand the software part.
There are basically 3 tiers of server, we would be interested in:
HTTP Server. This is basically just to serve static resources, including client side scripting languages. You can build quite a big piece of an application in GWT, and as long as it does not require any server side dynamic behaviour (say database access), you are good. But who doesn’t require database access those times? The unbeatable king of http servers is the Apache HTTP server. The piece of software that gave name to the entire organisation later. Before Java settled in the web, we would just take Perl or PHP, put it somewhere around Apache, lay hands on database, or whatever is needed and be happy. But now we have…
Web Container. It is more than http server, since it implements a tiny but important part of Java Enterprise Edition api. Namely Servlet and JSP. Those seem to be a bit outdated technologies, but they are a basis for every new and fancy stuff in Java web world. For example, Spring is actually a big servlet underneath. Again, there is a clear leader in this field, Apache Tomcat. But what, if you need more?
Application Server. The monstrosity that implements entire JEE specification. So, besides what web container offers, we have JSF, persistence, transactions, messaging, batch api and other stuff, but perhaps most notably: the Enterprise Java Beans. There quite a few application servers out in the field. I’ve worked with Weblogic and Glassfish. If you don’t like Oracle, there is also JBoss (it is called WildFly now, as I’ve just learned). Or Apache Geronimo for anarchists.
So, what do I actually need? Since I’m going to use Spring, and Spring has many features that replaces JEE standard (Actually many apis in modern JEE were inspired by Spring.), I’m not going to need full application server. Web Container is enough for Spring, so it should be enough for me. Since picking up a popular server simplifies hosting and development in general (lots of people have the same problem as you) I’ll go with Tomcat 8.0.9. If there would be a need for an application server in the future, we are going to have a migration. Shouldn’t be tough, should it?
And what about database? I have serious time issues recently, so in order not to keep this post too long in the draft state, we will talk this through in the next episode. Stay tuned.
Project-wise, I’ve set up Tomcat, created a project draft, installed MySQL and did some smoke test displaying stuff from the database via simple servlet. Nothing fancy, just hellowording. Now I’m looking for some nice MySQL client besides command line :) Any suggestions?